From 0b6a6202f6f54ac383bf4aaef1f7ac1b32b65c15 Mon Sep 17 00:00:00 2001 From: Jingfu Wang Date: Thu, 15 Aug 2024 10:42:20 -0400 Subject: [PATCH 1/9] feat: support customized block hash for balance API Signed-off-by: Jingfu Wang --- services/account_service.go | 7 +++++++ services/block_service.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/services/account_service.go b/services/account_service.go index b6dbd94..2dd906b 100644 --- a/services/account_service.go +++ b/services/account_service.go @@ -16,6 +16,7 @@ package services import ( "context" + "fmt" "github.com/coinbase/rosetta-geth-sdk/configuration" AssetTypes "github.com/coinbase/rosetta-geth-sdk/types" @@ -70,6 +71,12 @@ func (s *AccountAPIService) AccountBalance( return nil, AssetTypes.WrapErr(AssetTypes.ErrGeth, err) } + // get block hash if the block hash can't be calculated from keccak256 hash of its RLP encoding + balanceResponse.BlockIdentifier.Hash, err = s.client.GetBlockHash(ctx, *balanceResponse.BlockIdentifier) + if err != nil { + return nil, AssetTypes.WrapErr(AssetTypes.ErrInternalError, fmt.Errorf("could not get block hash given block identifier %v: %w", request.BlockIdentifier, err)) + } + return balanceResponse, nil } diff --git a/services/block_service.go b/services/block_service.go index cfd9c52..4c75c57 100644 --- a/services/block_service.go +++ b/services/block_service.go @@ -83,7 +83,7 @@ func (s *BlockAPIService) populateTransactions( } transaction, err := s.PopulateTransaction(ctx, tx) if err != nil { - return nil, fmt.Errorf("cannot parse %s: %w", tx.Transaction.Hash().Hex(), err) + return nil, fmt.Errorf("cannot parse %s: %w", tx.TxHash, err) } transactions = append(transactions, transaction) } From 771a6d06998955ec11c756a1a87aad2a63225a4f Mon Sep 17 00:00:00 2001 From: Jingfu Wang Date: Thu, 15 Aug 2024 10:50:10 -0400 Subject: [PATCH 2/9] chore: dummy commit Signed-off-by: Jingfu Wang --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7c88740..e8e7087 100644 --- a/Makefile +++ b/Makefile @@ -56,4 +56,4 @@ salus: check-format: ! gofmt -s -l . | read; ${GOIMPORTS_INSTALL} - ! ${GOIMPORTS_CMD} -l . | read; + ! ${GOIMPORTS_CMD} -l . | read; \ No newline at end of file From 0875714f655d99641e43b633d3bf027659beed7a Mon Sep 17 00:00:00 2001 From: Jingfu Wang Date: Thu, 15 Aug 2024 10:53:51 -0400 Subject: [PATCH 3/9] chore: dummy commit Signed-off-by: Jingfu Wang --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e8e7087..7c88740 100644 --- a/Makefile +++ b/Makefile @@ -56,4 +56,4 @@ salus: check-format: ! gofmt -s -l . | read; ${GOIMPORTS_INSTALL} - ! ${GOIMPORTS_CMD} -l . | read; \ No newline at end of file + ! ${GOIMPORTS_CMD} -l . | read; From 3232fa074daf6dc0efb48c9cbcf6ea405b5ed906 Mon Sep 17 00:00:00 2001 From: Jingfu Wang Date: Thu, 15 Aug 2024 11:01:47 -0400 Subject: [PATCH 4/9] test: install docker-compose in ci Signed-off-by: Jingfu Wang --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5d712c..e447631 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,14 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install Docker Compose via Package Manager + run: | + apt-get update + apt-get install -y docker-compose + + - name: Verify Docker Compose Installation + run: docker-compose --version + - name: Start a private ethereum network uses: ./.github/actions/geth id: geth From 9d4a4b1d6b01ef4c6c89d9ed0730b19ef30ea6f2 Mon Sep 17 00:00:00 2001 From: Jingfu Wang Date: Thu, 15 Aug 2024 11:03:59 -0400 Subject: [PATCH 5/9] test: update CI permission Signed-off-by: Jingfu Wang --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e447631..b00e7a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,13 @@ jobs: - name: Install Docker Compose via Package Manager run: | - apt-get update - apt-get install -y docker-compose + sudo apt-get update + sudo apt-get install -y docker-compose + shell: bash - name: Verify Docker Compose Installation run: docker-compose --version + shell: bash - name: Start a private ethereum network uses: ./.github/actions/geth From 5f2fdb05fa414f378cd26717fc39f6b89c4b5513 Mon Sep 17 00:00:00 2001 From: Jingfu Wang Date: Thu, 15 Aug 2024 11:17:44 -0400 Subject: [PATCH 6/9] chore: dummy commit Signed-off-by: Jingfu Wang --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7c88740..e8e7087 100644 --- a/Makefile +++ b/Makefile @@ -56,4 +56,4 @@ salus: check-format: ! gofmt -s -l . | read; ${GOIMPORTS_INSTALL} - ! ${GOIMPORTS_CMD} -l . | read; + ! ${GOIMPORTS_CMD} -l . | read; \ No newline at end of file From 6e2ec235d2ae03b4a5cfe4af88e04d8a7ace3f28 Mon Sep 17 00:00:00 2001 From: Jingfu Wang Date: Thu, 15 Aug 2024 11:18:19 -0400 Subject: [PATCH 7/9] chore: dummy commit Signed-off-by: Jingfu Wang --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e8e7087..7c88740 100644 --- a/Makefile +++ b/Makefile @@ -56,4 +56,4 @@ salus: check-format: ! gofmt -s -l . | read; ${GOIMPORTS_INSTALL} - ! ${GOIMPORTS_CMD} -l . | read; \ No newline at end of file + ! ${GOIMPORTS_CMD} -l . | read; From 94d7efa599eb949b542bdb133617d0ecd4fd7972 Mon Sep 17 00:00:00 2001 From: Jingfu Wang Date: Thu, 15 Aug 2024 11:26:46 -0400 Subject: [PATCH 8/9] test: add review requirement Signed-off-by: Jingfu Wang --- .codeflow.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .codeflow.yml diff --git a/.codeflow.yml b/.codeflow.yml new file mode 100644 index 0000000..96bdc94 --- /dev/null +++ b/.codeflow.yml @@ -0,0 +1,7 @@ +--- +secure: + required_reviews: 1 + requires_mfa: true +operate: + slack_channels: + - "#crypto-deploys" \ No newline at end of file From 9817c2a84020d0fec058c69789f006155910ae25 Mon Sep 17 00:00:00 2001 From: Jingfu Wang Date: Thu, 15 Aug 2024 11:36:16 -0400 Subject: [PATCH 9/9] chore: revert review change Signed-off-by: Jingfu Wang --- .codeflow.yml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .codeflow.yml diff --git a/.codeflow.yml b/.codeflow.yml deleted file mode 100644 index 96bdc94..0000000 --- a/.codeflow.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -secure: - required_reviews: 1 - requires_mfa: true -operate: - slack_channels: - - "#crypto-deploys" \ No newline at end of file