From 17723cbb4402f85c6074f03756fba8329e621ee1 Mon Sep 17 00:00:00 2001 From: jingwei zhuang Date: Tue, 17 Jan 2023 13:50:15 -0800 Subject: [PATCH 1/6] updates --- Dockerfile | 2 +- cmd/root.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1545c72b..07d7bbdc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" WORKDIR /go/src -ARG VERSION=v0.10.1 +ARG VERSION=v0.10.2 RUN git clone https://github.com/coinbase/rosetta-cli.git && \ cd rosetta-cli && \ git fetch --all --tags && \ diff --git a/cmd/root.go b/cmd/root.go index 747239ac..3cca1e7b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -488,6 +488,6 @@ var versionCmd = &cobra.Command{ Use: "version", Short: "Print rosetta-cli version", Run: func(cmd *cobra.Command, args []string) { - fmt.Println("v0.10.1") + fmt.Println("v0.10.2") }, } From b51a07073d6cf4769710ad50396829f26387d6bf Mon Sep 17 00:00:00 2001 From: jingwei zhuang Date: Tue, 17 Jan 2023 15:34:12 -0800 Subject: [PATCH 2/6] updates --- pkg/processor/balance_storage_helper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/processor/balance_storage_helper.go b/pkg/processor/balance_storage_helper.go index f043691d..fcad8aa5 100644 --- a/pkg/processor/balance_storage_helper.go +++ b/pkg/processor/balance_storage_helper.go @@ -65,6 +65,9 @@ func NewBalanceStorageHelper( // Pre-process exemptAccounts on initialization // to provide fast lookup while syncing. for _, account := range exemptAccounts { + if account.Currency == nil { + exemptMap[account.Account.Address] =struct{}{} + } exemptMap[types.Hash(account)] = struct{}{} } @@ -151,7 +154,8 @@ func (h *BalanceStorageHelper) ExemptFunc() parser.ExemptOperation { }) _, exists := h.exemptAccounts[thisAcct] - return exists + _, existsAddress := h.exemptAccounts[op.Account.Address] + return exists || existsAddress } } From f0a1eab0838ff221bd8acb5ec8591d099930e00e Mon Sep 17 00:00:00 2001 From: jingwei zhuang Date: Wed, 18 Jan 2023 10:37:32 -0800 Subject: [PATCH 3/6] updates --- pkg/processor/balance_storage_helper.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/processor/balance_storage_helper.go b/pkg/processor/balance_storage_helper.go index fcad8aa5..4283b8c5 100644 --- a/pkg/processor/balance_storage_helper.go +++ b/pkg/processor/balance_storage_helper.go @@ -65,8 +65,10 @@ func NewBalanceStorageHelper( // Pre-process exemptAccounts on initialization // to provide fast lookup while syncing. for _, account := range exemptAccounts { + // if users do not specify Currency, we added the address + // by this, all the Currencies in this address will be skipped if account.Currency == nil { - exemptMap[account.Account.Address] =struct{}{} + exemptMap[account.Account.Address] = struct{}{} } exemptMap[types.Hash(account)] = struct{}{} } @@ -153,6 +155,9 @@ func (h *BalanceStorageHelper) ExemptFunc() parser.ExemptOperation { Currency: op.Amount.Currency, }) + // if exemptAccounts have the hash of AccountCurrency or the Account address + // return true, if exemptAccounts have the Account address means all the + // currencies in this account need to be skipped _, exists := h.exemptAccounts[thisAcct] _, existsAddress := h.exemptAccounts[op.Account.Address] return exists || existsAddress From badb8d1e4a1f381b8088b7c64d71382618a1fd46 Mon Sep 17 00:00:00 2001 From: jingwei zhuang Date: Wed, 18 Jan 2023 10:41:01 -0800 Subject: [PATCH 4/6] updates --- pkg/processor/balance_storage_helper.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/processor/balance_storage_helper.go b/pkg/processor/balance_storage_helper.go index 4283b8c5..9e957d22 100644 --- a/pkg/processor/balance_storage_helper.go +++ b/pkg/processor/balance_storage_helper.go @@ -65,7 +65,7 @@ func NewBalanceStorageHelper( // Pre-process exemptAccounts on initialization // to provide fast lookup while syncing. for _, account := range exemptAccounts { - // if users do not specify Currency, we added the address + // if users do not specify Currency, we add the address // by this, all the Currencies in this address will be skipped if account.Currency == nil { exemptMap[account.Account.Address] = struct{}{} @@ -156,8 +156,8 @@ func (h *BalanceStorageHelper) ExemptFunc() parser.ExemptOperation { }) // if exemptAccounts have the hash of AccountCurrency or the Account address - // return true, if exemptAccounts have the Account address means all the - // currencies in this account need to be skipped + // return true, as if exemptAccounts have the Account address means all the + // currencies in this Account address need to be skipped _, exists := h.exemptAccounts[thisAcct] _, existsAddress := h.exemptAccounts[op.Account.Address] return exists || existsAddress From 7e3ba99f8e31fd39dfbc159a5497ddfe9565ddfd Mon Sep 17 00:00:00 2001 From: jingwei zhuang Date: Wed, 18 Jan 2023 10:57:13 -0800 Subject: [PATCH 5/6] updates --- pkg/processor/balance_storage_helper.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/processor/balance_storage_helper.go b/pkg/processor/balance_storage_helper.go index 9e957d22..d9492fe7 100644 --- a/pkg/processor/balance_storage_helper.go +++ b/pkg/processor/balance_storage_helper.go @@ -69,8 +69,9 @@ func NewBalanceStorageHelper( // by this, all the Currencies in this address will be skipped if account.Currency == nil { exemptMap[account.Account.Address] = struct{}{} + } else { + exemptMap[types.Hash(account)] = struct{}{} } - exemptMap[types.Hash(account)] = struct{}{} } return &BalanceStorageHelper{ From 380687cffa2c7c7016bd2e8e34bf6ac4570ee499 Mon Sep 17 00:00:00 2001 From: jingwei zhuang Date: Wed, 18 Jan 2023 11:00:36 -0800 Subject: [PATCH 6/6] updates --- pkg/processor/balance_storage_helper.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/processor/balance_storage_helper.go b/pkg/processor/balance_storage_helper.go index d9492fe7..6f929b47 100644 --- a/pkg/processor/balance_storage_helper.go +++ b/pkg/processor/balance_storage_helper.go @@ -150,18 +150,20 @@ func (h *BalanceStorageHelper) ExemptFunc() parser.ExemptOperation { return true } } + // if exemptAccounts have the Account address means all the + // currencies in this Account address need to be skipped + _, existsAddress := h.exemptAccounts[op.Account.Address] + if existsAddress { + return existsAddress + } thisAcct := types.Hash(&types.AccountCurrency{ Account: op.Account, Currency: op.Amount.Currency, }) - // if exemptAccounts have the hash of AccountCurrency or the Account address - // return true, as if exemptAccounts have the Account address means all the - // currencies in this Account address need to be skipped _, exists := h.exemptAccounts[thisAcct] - _, existsAddress := h.exemptAccounts[op.Account.Address] - return exists || existsAddress + return exists } }