From 7714cd88c15b13a8900b457100cdf908a2c2e4ee Mon Sep 17 00:00:00 2001 From: bbaktaeho Date: Thu, 16 Nov 2023 23:04:53 +0900 Subject: [PATCH 1/7] fix GetTransactionReceiptsByBlock --- internal/ethapi/api.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 83b8f22edf..ac8a273b2a 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -723,8 +723,13 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block "logs": receipt.Logs, "logsBloom": receipt.Bloom, "type": hexutil.Uint(tx.Type()), + "effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice), } + if receipt.EffectiveGasPrice == nil { + fields["effectiveGasPrice"] = new(hexutil.Big) + } + // Assign receipt status or post state. if len(receipt.PostState) > 0 { fields["root"] = hexutil.Bytes(receipt.PostState) @@ -733,7 +738,7 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block } if receipt.Logs == nil { - fields["logs"] = [][]*types.Log{} + fields["logs"] = []*types.Log{} } if borReceipt != nil && idx == len(receipts)-1 { From 18c880280bf04f99418841f502722f6a8f17c506 Mon Sep 17 00:00:00 2001 From: bbaktaeho Date: Fri, 17 Nov 2023 19:34:50 +0900 Subject: [PATCH 2/7] fix: lint --- internal/ethapi/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index ac8a273b2a..77e9bb6dd3 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -727,8 +727,8 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block } if receipt.EffectiveGasPrice == nil { - fields["effectiveGasPrice"] = new(hexutil.Big) - } + fields["effectiveGasPrice"] = new(hexutil.Big) + } // Assign receipt status or post state. if len(receipt.PostState) > 0 { From db5b398ab6e71e0d470898438c7d1b6276665390 Mon Sep 17 00:00:00 2001 From: marcello33 Date: Fri, 8 Dec 2023 06:56:23 +0100 Subject: [PATCH 3/7] Update matic-cli in CI (#1103) --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d8c35d572..f339deb474 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: - name: Test run: make test - + - uses: actions/upload-artifact@v2 with: name: unitTest-coverage @@ -217,7 +217,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: '16.17.1' + node-version: '18.19.0' cache: 'npm' cache-dependency-path: | matic-cli/package-lock.json @@ -231,7 +231,7 @@ jobs: npm install --prefer-offline --no-audit --progress=false mkdir devnet cd devnet - ../bin/matic-cli setup devnet -c ../../bor/.github/matic-cli-config.yml + ../bin/matic-cli.js setup devnet -c ../../bor/.github/matic-cli-config.yml - name: Launch devnet run: | From 8b2f02419d81daed30462c986ccff0f34d985bf4 Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Fri, 15 Dec 2023 12:49:11 +0530 Subject: [PATCH 4/7] test all default flags added via config file (#1105) --- internal/cli/server/config_legacy_test.go | 19 +++ internal/cli/server/testdata/default.toml | 193 ++++++++++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 internal/cli/server/testdata/default.toml diff --git a/internal/cli/server/config_legacy_test.go b/internal/cli/server/config_legacy_test.go index aa6cffc470..e9957c3353 100644 --- a/internal/cli/server/config_legacy_test.go +++ b/internal/cli/server/config_legacy_test.go @@ -42,3 +42,22 @@ func TestConfigLegacy(t *testing.T) { readFile("./testdata/test.toml") }) } + +func TestDefaultConfigLegacy(t *testing.T) { + readFile := func(path string) { + expectedConfig, err := readLegacyConfig(path) + assert.NoError(t, err) + + testConfig := DefaultConfig() + + testConfig.Identity = "Polygon-Devs" + testConfig.DataDir = "/var/lib/bor" + + assert.Equal(t, expectedConfig, testConfig) + } + + // read file in hcl format + t.Run("toml", func(t *testing.T) { + readFile("./testdata/default.toml") + }) +} diff --git a/internal/cli/server/testdata/default.toml b/internal/cli/server/testdata/default.toml new file mode 100644 index 0000000000..3a6c2f0cb5 --- /dev/null +++ b/internal/cli/server/testdata/default.toml @@ -0,0 +1,193 @@ +chain = "mainnet" +identity = "Polygon-Devs" +verbosity = 3 +log-level = "" +vmdebug = false +datadir = "/var/lib/bor" +ancient = "" +"db.engine" = "leveldb" +keystore = "" +"rpc.batchlimit" = 100 +"rpc.returndatalimit" = 100000 +syncmode = "full" +gcmode = "full" +snapshot = true +"bor.logs" = false +ethstats = "" +devfakeauthor = false + +["eth.requiredblocks"] + +[log] + vmodule = "" + json = false + backtrace = "" + debug = false + +[p2p] + maxpeers = 50 + maxpendpeers = 50 + bind = "0.0.0.0" + port = 30303 + nodiscover = false + nat = "any" + netrestrict = "" + nodekey = "" + nodekeyhex = "" + txarrivalwait = "500ms" + [p2p.discovery] + v4disc = true + v5disc = false + bootnodes = [] + bootnodesv4 = [] + bootnodesv5 = [] + static-nodes = [] + trusted-nodes = [] + dns = [] + +[heimdall] + url = "http://localhost:1317" + "bor.without" = false + grpc-address = "" + "bor.runheimdall" = false + "bor.runheimdallargs" = "" + "bor.useheimdallapp" = false + +[txpool] + locals = [] + nolocals = false + journal = "transactions.rlp" + rejournal = "1h0m0s" + pricelimit = 1 + pricebump = 10 + accountslots = 16 + globalslots = 32768 + accountqueue = 16 + globalqueue = 32768 + lifetime = "3h0m0s" + +[miner] + mine = false + etherbase = "" + extradata = "" + gaslimit = 30000000 + gasprice = "1000000000" + recommit = "2m5s" + commitinterrupt = true + +[jsonrpc] + ipcdisable = false + ipcpath = "" + gascap = 50000000 + evmtimeout = "5s" + txfeecap = 1.0 + allow-unprotected-txs = false + enabledeprecatedpersonal = false + [jsonrpc.http] + enabled = false + port = 8545 + prefix = "" + host = "localhost" + api = ["eth", "net", "web3", "txpool", "bor"] + vhosts = ["localhost"] + corsdomain = ["localhost"] + ep-size = 40 + ep-requesttimeout = "0s" + [jsonrpc.ws] + enabled = false + port = 8546 + prefix = "" + host = "localhost" + api = ["net", "web3"] + origins = ["localhost"] + ep-size = 40 + ep-requesttimeout = "0s" + [jsonrpc.graphql] + enabled = false + port = 0 + prefix = "" + host = "" + vhosts = ["localhost"] + corsdomain = ["localhost"] + ep-size = 0 + ep-requesttimeout = "" + [jsonrpc.auth] + jwtsecret = "" + addr = "localhost" + port = 8551 + vhosts = ["localhost"] + [jsonrpc.timeouts] + read = "10s" + write = "30s" + idle = "2m0s" + +[gpo] + blocks = 20 + percentile = 60 + maxheaderhistory = 1024 + maxblockhistory = 1024 + maxprice = "500000000000" + ignoreprice = "2" + +[telemetry] + metrics = false + expensive = false + prometheus-addr = "127.0.0.1:7071" + opencollector-endpoint = "" + [telemetry.influx] + influxdb = false + endpoint = "" + database = "" + username = "" + password = "" + influxdbv2 = false + token = "" + bucket = "" + organization = "" + [telemetry.influx.tags] + +[cache] + cache = 1024 + gc = 25 + snapshot = 10 + database = 50 + trie = 15 + noprefetch = false + preimages = false + txlookuplimit = 2350000 + triesinmemory = 128 + blocklogs = 32 + timeout = "1h0m0s" + fdlimit = 0 + +[leveldb] + compactiontablesize = 2 + compactiontablesizemultiplier = 1.0 + compactiontotalsize = 10 + compactiontotalsizemultiplier = 10.0 + +[accounts] + unlock = [] + password = "" + allow-insecure-unlock = false + lightkdf = false + disable-bor-wallet = true + +[grpc] + addr = ":3131" + +[developer] + dev = false + period = 0 + gaslimit = 11500000 + +[parallelevm] + enable = true + procs = 8 + +[pprof] + pprof = false + port = 6060 + addr = "127.0.0.1" + memprofilerate = 524288 + blockprofilerate = 0 From dac4c40cf099571abc4b71aef757ea4f8424e118 Mon Sep 17 00:00:00 2001 From: Vaibhav Jindal Date: Mon, 18 Dec 2023 15:38:12 +0530 Subject: [PATCH 5/7] Removed the check for milestoneID in the GetVoteOnHash() --- eth/bor_api_backend.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/eth/bor_api_backend.go b/eth/bor_api_backend.go index dbc6844d8a..9f909caa8e 100644 --- a/eth/bor_api_backend.go +++ b/eth/bor_api_backend.go @@ -83,21 +83,6 @@ func (b *EthAPIBackend) GetVoteOnHash(ctx context.Context, starBlockNr uint64, e return false, fmt.Errorf("Hash mismatch: localChainHash %s, milestoneHash %s", localEndBlockHash, hash) } - ethHandler := (*ethHandler)(b.eth.handler) - - bor, ok := ethHandler.chain.Engine().(*bor.Bor) - - if !ok { - return false, fmt.Errorf("Bor not available") - } - - err = bor.HeimdallClient.FetchMilestoneID(ctx, milestoneId) - - if err != nil { - downloader.UnlockMutex(false, "", endBlockNr, common.Hash{}) - return false, fmt.Errorf("Milestone ID doesn't exist in Heimdall") - } - downloader.UnlockMutex(true, milestoneId, endBlockNr, localEndBlock.Hash()) return true, nil From 937dd6aa669580f7940563d9482171f7eb8d9f96 Mon Sep 17 00:00:00 2001 From: Leo Lim <48875325+bbaktaeho@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:34:45 +0900 Subject: [PATCH 6/7] internal/ethapi: fix signer in GetTransactionReceiptsByBlock method (#1107) * fix: from address * add: unit test for GetTransactionReceiptsByBlock --- internal/ethapi/api.go | 8 +- internal/ethapi/api_test.go | 248 ++++++++++++++++++++++++++++++++++++ 2 files changed, 250 insertions(+), 6 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 77e9bb6dd3..25e05ac17d 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -702,12 +702,8 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block for idx, receipt := range receipts { tx := txs[idx] - var signer types.Signer = types.FrontierSigner{} - - if tx.Protected() { - signer = types.NewEIP155Signer(tx.ChainId()) - } - + // Derive the sender. + signer := types.MakeSigner(s.b.ChainConfig(), block.Number(), block.Time()) from, _ := types.Sender(signer, tx) fields := map[string]interface{}{ diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 152a24ddef..6fe9a54130 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -2146,3 +2146,251 @@ func TestRPCGetTransactionReceipt(t *testing.T) { require.JSONEqf(t, want, have, "test %d: json not match, want: %s, have: %s", i, want, have) } } + +func TestRPCGetTransactionReceiptsByBlock(t *testing.T) { + t.Parallel() + + // Initialize test accounts + var ( + acc1Key, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a") + acc2Key, _ = crypto.HexToECDSA("49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee") + acc1Addr = crypto.PubkeyToAddress(acc1Key.PublicKey) + acc2Addr = crypto.PubkeyToAddress(acc2Key.PublicKey) + contract = common.HexToAddress("0000000000000000000000000000000000031ec7") + genesis = &core.Genesis{ + Config: params.TestChainConfig, + Alloc: core.GenesisAlloc{ + acc1Addr: {Balance: big.NewInt(params.Ether)}, + acc2Addr: {Balance: big.NewInt(params.Ether)}, + contract: {Balance: big.NewInt(params.Ether), Code: common.FromHex("0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063a9059cbb14610030575b600080fd5b61004a6004803603810190610045919061016a565b610060565b60405161005791906101c5565b60405180910390f35b60008273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516100bf91906101ef565b60405180910390a36001905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610101826100d6565b9050919050565b610111816100f6565b811461011c57600080fd5b50565b60008135905061012e81610108565b92915050565b6000819050919050565b61014781610134565b811461015257600080fd5b50565b6000813590506101648161013e565b92915050565b60008060408385031215610181576101806100d1565b5b600061018f8582860161011f565b92505060206101a085828601610155565b9150509250929050565b60008115159050919050565b6101bf816101aa565b82525050565b60006020820190506101da60008301846101b6565b92915050565b6101e981610134565b82525050565b600060208201905061020460008301846101e0565b9291505056fea2646970667358221220b469033f4b77b9565ee84e0a2f04d496b18160d26034d54f9487e57788fd36d564736f6c63430008120033")}, + }, + } + genTxs = 5 + genBlocks = 1 + signer = types.LatestSignerForChainID(params.TestChainConfig.ChainID) + txHashes = make([]common.Hash, 0, genTxs) + ) + + backend := newTestBackend(t, genBlocks, genesis, func(i int, b *core.BlockGen) { + switch i { + case 0: + // transfer 1000wei + tx1, _ := types.SignTx(types.NewTx(&types.LegacyTx{Nonce: uint64(0), To: &acc2Addr, Value: big.NewInt(1000), Gas: params.TxGas, GasPrice: b.BaseFee(), Data: nil}), types.HomesteadSigner{}, acc1Key) + b.AddTx(tx1) + txHashes = append(txHashes, tx1.Hash()) + + // create contract + tx2, _ := types.SignTx(types.NewTx(&types.LegacyTx{Nonce: uint64(1), To: nil, Gas: 53100, GasPrice: b.BaseFee(), Data: common.FromHex("0x60806040")}), signer, acc1Key) + b.AddTx(tx2) + txHashes = append(txHashes, tx2.Hash()) + + // with logs + // transfer(address to, uint256 value) + data3 := fmt.Sprintf("0xa9059cbb%s%s", common.HexToHash(common.BigToAddress(big.NewInt(int64(i + 1))).Hex()).String()[2:], common.BytesToHash([]byte{byte(i + 11)}).String()[2:]) + tx3, _ := types.SignTx(types.NewTx(&types.LegacyTx{Nonce: uint64(2), To: &contract, Gas: 60000, GasPrice: b.BaseFee(), Data: common.FromHex(data3)}), signer, acc1Key) + b.AddTx(tx3) + txHashes = append(txHashes, tx3.Hash()) + + // dynamic fee with logs + // transfer(address to, uint256 value) + data4 := fmt.Sprintf("0xa9059cbb%s%s", common.HexToHash(common.BigToAddress(big.NewInt(int64(i + 1))).Hex()).String()[2:], common.BytesToHash([]byte{byte(i + 11)}).String()[2:]) + fee := big.NewInt(500) + fee.Add(fee, b.BaseFee()) + tx4, _ := types.SignTx(types.NewTx(&types.DynamicFeeTx{Nonce: uint64(3), To: &contract, Gas: 60000, Value: big.NewInt(1), GasTipCap: big.NewInt(500), GasFeeCap: fee, Data: common.FromHex(data4)}), signer, acc1Key) + b.AddTx(tx4) + txHashes = append(txHashes, tx4.Hash()) + + // access list with contract create + accessList := types.AccessList{{ + Address: contract, + StorageKeys: []common.Hash{{0}}, + }} + tx5, _ := types.SignTx(types.NewTx(&types.AccessListTx{Nonce: uint64(4), To: nil, Gas: 58100, GasPrice: b.BaseFee(), Data: common.FromHex("0x60806040"), AccessList: accessList}), signer, acc1Key) + b.AddTx(tx5) + txHashes = append(txHashes, tx5.Hash()) + } + }) + + api := NewBlockChainAPI(backend) + blockHashes := make([]common.Hash, genBlocks+1) + ctx := context.Background() + for i := 0; i <= genBlocks; i++ { + header, err := backend.HeaderByNumber(ctx, rpc.BlockNumber(i)) + if err != nil { + t.Errorf("failed to get block: %d err: %v", i, err) + } + blockHashes[i] = header.Hash() + } + blockNrOrHash := rpc.BlockNumberOrHashWithHash(blockHashes[1], true) + + var testSuite = []struct { + txHash common.Hash + want string + }{ + // 0. normal success + { + txHash: txHashes[0], + want: `{ + "blockHash": "0x1728b788dfe51e507d25f14f01414b5a17f807953c13833811d2afae1982b53b", + "blockNumber": "0x1", + "contractAddress": null, + "cumulativeGasUsed": "0x5208", + "effectiveGasPrice": "0x342770c0", + "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", + "gasUsed": "0x5208", + "logs": [ + { + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x000000000000000000000000703c4b2bd70c169f5717101caee543299fc946c7", + "0x0000000000000000000000000d3ab14bbad3d99f4203bd7a11acb94882050e7e" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000de0a5fd640afa000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0a5fd640af6180000000000000000000000000000000000000000000000000de0b6b3a76403e8", + "blockNumber": "0x1", + "transactionHash": "0x644a31c354391520d00e95b9affbbb010fc79ac268144ab8e28207f4cf51097e", + "transactionIndex": "0x0", + "blockHash": "0x1728b788dfe51e507d25f14f01414b5a17f807953c13833811d2afae1982b53b", + "logIndex": "0x0", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000808000000000000000000000000000000000000000000000000000000000800000000000000000000100000020000000000000000000000000000000000802000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000800000000000000000000000800000108000000000000000000000000000000000000000000000000020000000000000000000100000", + "status": "0x1", + "to": "0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e", + "transactionHash": "0x644a31c354391520d00e95b9affbbb010fc79ac268144ab8e28207f4cf51097e", + "transactionIndex": "0x0", + "type": "0x0" + }`, + }, + // 1. create contract + { + txHash: txHashes[1], + want: `{ + "blockHash": "0x1728b788dfe51e507d25f14f01414b5a17f807953c13833811d2afae1982b53b", + "blockNumber": "0x1", + "contractAddress": "0xae9bea628c4ce503dcfd7e305cab4e29e7476592", + "cumulativeGasUsed": "0x12156", + "effectiveGasPrice": "0x342770c0", + "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", + "gasUsed": "0xcf4e", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "status": "0x1", + "to": null, + "transactionHash": "0x705a7fca1d214002ee90d4e1c651b53e3506e6d5e3a539e9a7f7bf05b49add91", + "transactionIndex": "0x1", + "type": "0x0" + }`, + }, + // 2. with logs success + { + txHash: txHashes[2], + want: `{ + "blockHash": "0x1728b788dfe51e507d25f14f01414b5a17f807953c13833811d2afae1982b53b", + "blockNumber": "0x1", + "contractAddress": null, + "cumulativeGasUsed": "0x17f7e", + "effectiveGasPrice": "0x342770c0", + "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", + "gasUsed": "0x5e28", + "logs": [ + { + "address": "0x0000000000000000000000000000000000031ec7", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000703c4b2bd70c169f5717101caee543299fc946c7", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000b", + "blockNumber": "0x1", + "transactionHash": "0xa228af0975b99799bd28331085a6966aba2fb5814a8d89aabc342462aa40429a", + "transactionIndex": "0x2", + "blockHash": "0x1728b788dfe51e507d25f14f01414b5a17f807953c13833811d2afae1982b53b", + "logIndex": "0x1", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000800000000000000008000000000000000000040000000000000020000000080000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000800000000000000000000000000000000000000040000000000000000000000000000000000000000020000000000000000000000000", + "status": "0x1", + "to": "0x0000000000000000000000000000000000031ec7", + "transactionHash": "0xa228af0975b99799bd28331085a6966aba2fb5814a8d89aabc342462aa40429a", + "transactionIndex": "0x2", + "type": "0x0" + }`, + }, + // 3. dynamic tx with logs success + { + txHash: txHashes[3], + want: `{ + "blockHash": "0x1728b788dfe51e507d25f14f01414b5a17f807953c13833811d2afae1982b53b", + "blockNumber": "0x1", + "contractAddress": null, + "cumulativeGasUsed": "0x1d30b", + "effectiveGasPrice": "0x342772b4", + "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", + "gasUsed": "0x538d", + "logs": [ + { + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x000000000000000000000000703c4b2bd70c169f5717101caee543299fc946c7", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000a32f640000000000000000000000000000000000000000000000000de06892fa4b3d9800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de06892f9a80e340000000000000000000000000000000000000000000000000000000000a32f64", + "blockNumber": "0x1", + "transactionHash": "0xc2cc458a65bc96f642d4a2063cce162b0da642613d801271bdbc4aa7e775f3ed", + "transactionIndex": "0x3", + "blockHash": "0x1728b788dfe51e507d25f14f01414b5a17f807953c13833811d2afae1982b53b", + "logIndex": "0x2", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000020000000000000020000000000000000000800000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001800000000000000000000000000000100000000020000000000000000000000000000000000000000020000000000000000000100000", + "status": "0x0", + "to": "0x0000000000000000000000000000000000031ec7", + "transactionHash": "0xc2cc458a65bc96f642d4a2063cce162b0da642613d801271bdbc4aa7e775f3ed", + "transactionIndex": "0x3", + "type": "0x2" + }`, + }, + // 4. access list tx with create contract + { + txHash: txHashes[4], + want: `{ + "blockHash": "0x1728b788dfe51e507d25f14f01414b5a17f807953c13833811d2afae1982b53b", + "blockNumber": "0x1", + "contractAddress": "0xfdaa97661a584d977b4d3abb5370766ff5b86a18", + "cumulativeGasUsed": "0x2b325", + "effectiveGasPrice": "0x342770c0", + "from": "0x703c4b2bd70c169f5717101caee543299fc946c7", + "gasUsed": "0xe01a", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "status": "0x1", + "to": null, + "transactionHash": "0x1e1161cf3fd01a02fc9c5ee66fc45a4805b3828bf41edd54213c20d97fc12b1d", + "transactionIndex": "0x4", + "type": "0x1" + }`, + }, + } + + receipts, err := api.GetTransactionReceiptsByBlock(context.Background(), blockNrOrHash) + if err != nil { + t.Fatal("api error") + } + + for i, tt := range testSuite { + data, err := json.Marshal(receipts[i]) + if err != nil { + t.Errorf("test %d: json marshal error", i) + continue + } + want, have := tt.want, string(data) + require.JSONEqf(t, want, have, "test %d: json not match, want: %s, have: %s", i, want, have) + } +} From 01e15709cc96d57e3cd5c1698122e21bd418566d Mon Sep 17 00:00:00 2001 From: marcello33 Date: Tue, 2 Jan 2024 15:06:51 +0100 Subject: [PATCH 7/7] chg: bump some deps for sec vulsn (#1113) --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index e0743c33e5..d26aab17b2 100644 --- a/go.mod +++ b/go.mod @@ -81,11 +81,11 @@ require ( github.com/tyler-smith/go-bip39 v1.1.0 github.com/urfave/cli/v2 v2.24.1 go.uber.org/automaxprocs v1.5.2 - golang.org/x/crypto v0.14.0 + golang.org/x/crypto v0.17.0 golang.org/x/exp v0.0.0-20230810033253-352e893a4cad golang.org/x/sync v0.3.0 - golang.org/x/sys v0.13.0 - golang.org/x/text v0.13.0 + golang.org/x/sys v0.15.0 + golang.org/x/text v0.14.0 golang.org/x/time v0.3.0 golang.org/x/tools v0.10.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 diff --git a/go.sum b/go.sum index 4fedf2b11b..fd6c869cc7 100644 --- a/go.sum +++ b/go.sum @@ -2256,8 +2256,8 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2618,8 +2618,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -2651,8 +2651,8 @@ golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=