From 63e8d7b68a250dce7f3ff00ca2200be73fef7b9f Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 24 Nov 2022 12:48:33 +0100 Subject: [PATCH 1/6] define eth_account --- src/eth/state.yaml | 15 +++++++++++++++ src/schemas/state.yaml | 21 +++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/eth/state.yaml b/src/eth/state.yaml index 08929db6b..901666f7a 100644 --- a/src/eth/state.yaml +++ b/src/eth/state.yaml @@ -84,3 +84,18 @@ name: Account schema: $ref: '#/components/schemas/AccountProof' +- name: eth_getAccount + summary: Returns the account at given address, or 'null' if the account does not exist in the state. + params: + - name: Address + required: true + schema: + $ref: '#/components/schemas/address' + - name: Block + required: false + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Account + schema: + $ref: '#/components/schemas/Account' diff --git a/src/schemas/state.yaml b/src/schemas/state.yaml index e50a968b3..c8537c750 100644 --- a/src/schemas/state.yaml +++ b/src/schemas/state.yaml @@ -54,3 +54,24 @@ StorageProof: type: array items: $ref: '#/components/schemas/bytes' +Account: + title: Account + type: object + required: + - root + - balance + - nonce + - codeHash + properties: + root: + title: storage root + $ref: '#/components/schemas/hash32' + balance: + title: balance + $ref: '#/components/schemas/uint256' + codeHash: + title: codeHash + $ref: '#/components/schemas/hash32' + nonce: + title: nonce + $ref: '#/components/schemas/uint64' From 8ffc721fb3ef559c0f72d78464eac532b1c91d90 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 24 Nov 2022 13:45:01 +0100 Subject: [PATCH 2/6] test for eth_getAccount --- tests/eth_getAccount/get-account.io | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/eth_getAccount/get-account.io diff --git a/tests/eth_getAccount/get-account.io b/tests/eth_getAccount/get-account.io new file mode 100644 index 000000000..97d19f7ce --- /dev/null +++ b/tests/eth_getAccount/get-account.io @@ -0,0 +1,6 @@ +>> {"jsonrpc":"2.0","id":9,"method":"eth_getAccount","params":["0x000000000000000000000000000000000000dead","latest"]} +<< {"jsonrpc":"2.0","id":9,"result": null} +>> {"jsonrpc":"2.0","id":10,"method":"eth_getAccount","params":["0xaa00000000000000000000000000000000000000","latest"]} +<< {"jsonrpc":"2.0","id":10,"result": { "codeHash": "0xce92c756baff35fa740c3557c1a971fd24d2d35b7c8e067880d50cd86bb0bc99", "root": "0x8afc95b7d18a226944b9c2070b6bda1c3a36afcc3730429d47579c94b9fe5850", "balance": "0x1", "nonce": "0x1"}} +>> {"jsonrpc":"2.0","id":11,"method":"eth_getAccount","params":["0xaa00000000000000000000000000000000000000","0xffff"]} +<< {"jsonrpc":"2.0","id":11,"error":{"code":-32000,"message":"header not found"}} From 9a33c6ae5f7c65dbea98a8b5755a5413129848d8 Mon Sep 17 00:00:00 2001 From: "lightclient@protonmail.com" Date: Tue, 29 Nov 2022 07:14:49 -0700 Subject: [PATCH 3/6] make eth_getAccount nullable --- src/eth/state.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/eth/state.yaml b/src/eth/state.yaml index 901666f7a..2868d0b4f 100644 --- a/src/eth/state.yaml +++ b/src/eth/state.yaml @@ -98,4 +98,8 @@ result: name: Account schema: - $ref: '#/components/schemas/Account' + oneOf: + - $ref: '#/components/schemas/Account' + - name: Null + type: "null" + From 83732eeba0de078dedce008fd92e8cdfb123e09a Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 2 Feb 2023 08:37:26 -0500 Subject: [PATCH 4/6] Update src/schemas/state.yaml --- src/schemas/state.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schemas/state.yaml b/src/schemas/state.yaml index c8537c750..59e8a8766 100644 --- a/src/schemas/state.yaml +++ b/src/schemas/state.yaml @@ -58,7 +58,7 @@ Account: title: Account type: object required: - - root + - storageRoot - balance - nonce - codeHash From bd11a2ba46366c1037f99d294e7803125a7d50bc Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 2 Feb 2023 08:37:38 -0500 Subject: [PATCH 5/6] Update src/schemas/state.yaml --- src/schemas/state.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schemas/state.yaml b/src/schemas/state.yaml index 59e8a8766..ad0108d37 100644 --- a/src/schemas/state.yaml +++ b/src/schemas/state.yaml @@ -63,7 +63,7 @@ Account: - nonce - codeHash properties: - root: + storageRoot: title: storage root $ref: '#/components/schemas/hash32' balance: From 457560e5e6383eaed31bb6bc6f2031fe2c802f5e Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 2 Feb 2023 08:37:46 -0500 Subject: [PATCH 6/6] Update tests/eth_getAccount/get-account.io --- tests/eth_getAccount/get-account.io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/eth_getAccount/get-account.io b/tests/eth_getAccount/get-account.io index 97d19f7ce..ab480f609 100644 --- a/tests/eth_getAccount/get-account.io +++ b/tests/eth_getAccount/get-account.io @@ -1,6 +1,6 @@ >> {"jsonrpc":"2.0","id":9,"method":"eth_getAccount","params":["0x000000000000000000000000000000000000dead","latest"]} << {"jsonrpc":"2.0","id":9,"result": null} >> {"jsonrpc":"2.0","id":10,"method":"eth_getAccount","params":["0xaa00000000000000000000000000000000000000","latest"]} -<< {"jsonrpc":"2.0","id":10,"result": { "codeHash": "0xce92c756baff35fa740c3557c1a971fd24d2d35b7c8e067880d50cd86bb0bc99", "root": "0x8afc95b7d18a226944b9c2070b6bda1c3a36afcc3730429d47579c94b9fe5850", "balance": "0x1", "nonce": "0x1"}} +<< {"jsonrpc":"2.0","id":10,"result": { "codeHash": "0xce92c756baff35fa740c3557c1a971fd24d2d35b7c8e067880d50cd86bb0bc99", "storageRoot": "0x8afc95b7d18a226944b9c2070b6bda1c3a36afcc3730429d47579c94b9fe5850", "balance": "0x1", "nonce": "0x1"}} >> {"jsonrpc":"2.0","id":11,"method":"eth_getAccount","params":["0xaa00000000000000000000000000000000000000","0xffff"]} << {"jsonrpc":"2.0","id":11,"error":{"code":-32000,"message":"header not found"}}