Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hexutil.Uint for blockCount parameter and oldestBlock result value in feeHistory method #23239

Merged
merged 4 commits into from Jul 27, 2021

Conversation

@lightclient
Copy link
Member

@lightclient lightclient commented Jul 20, 2021

The current spec uses an Integer type for the blockCount parameter and OldestBlock result value. The schema for these values define them to be a hex string.

(h/t @ryanschneider for finding)

Copy link
Contributor

@ryanschneider ryanschneider left a comment

Note that this will be a breaking change from 1.10.5 which was released with the previous behavior. I'm definitely torn on that.

@juanfranblanco
Copy link

@juanfranblanco juanfranblanco commented Jul 21, 2021

H!i Also note that the "oldestBlock" in the output is also not Hex

Copy link
Contributor

@rjl493456442 rjl493456442 left a comment

Just nitpicks.
@zsfelfoldi Please also check it, especially in the spec the OldestBlock type is rpc.BlockNumber but I think hexutil.Big is better since it can always be resolved.

eth/gasprice/feehistory.go Outdated Show resolved Hide resolved
eth/gasprice/feehistory.go Outdated Show resolved Hide resolved
internal/ethapi/api.go Show resolved Hide resolved
@lightclient lightclient force-pushed the fix-blockcount-type branch from fffd5e8 to 0756404 Jul 25, 2021
Copy link
Contributor

@zsfelfoldi zsfelfoldi left a comment

LGTM (after fixing a build failure in the tests)

@zsfelfoldi zsfelfoldi merged commit bbfa648 into ethereum:master Jul 27, 2021
1 of 2 checks passed
@lightclient
Copy link
Member Author

@lightclient lightclient commented Jul 27, 2021

@zsfelfoldi doh thanks for fixing the test.

@holiman holiman added this to the 1.10.7 milestone Jul 27, 2021
@holiman
Copy link
Contributor

@holiman holiman commented Jul 27, 2021

@zsfelfoldi don't forget to set the milestone when merging a PR

sidhujag added a commit to sidhujag/go-ethereum that referenced this issue Jul 28, 2021
…thereum#23239)

* internal/ethapi/api: use hexutil.uint for blockCount parameter instead of int for feeHistory

* return hex value for oldestBlock instead of number

* return uint64 from oracle.resolveBlockRange

* eth/gasprice: fixed test

Co-authored-by: Zsolt Felfoldi <zsfelfoldi@gmail.com>
@lightclient lightclient changed the title Use hexutil.Uint for blockCount parameter in feeHistory method Use hexutil.Uint for blockCount parameter and oldestBlock result value in feeHistory method Jul 30, 2021
reds pushed a commit to reds/go-ethereum that referenced this issue Aug 28, 2021
…thereum#23239)

* internal/ethapi/api: use hexutil.uint for blockCount parameter instead of int for feeHistory

* return hex value for oldestBlock instead of number

* return uint64 from oracle.resolveBlockRange

* eth/gasprice: fixed test

Co-authored-by: Zsolt Felfoldi <zsfelfoldi@gmail.com>
Copy link

@Farzin3 Farzin3 left a comment

``>>> import hashlib

m = hashlib.sha256()
m.update(b"Nobody inspects")
m.update(b" the spammish repetition")
m.digest()
b'\x03\x1e\xdd}Ae\x15\x93\xc5\xfe\\x00o\xa5u+7\xfd\xdf\xf7\xbcN\x84:\xa6\xaf\x0c\x95\x0fK\x94\x06'
m.digest_size
32
m.block_size
64
متراکم تر:

hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()
'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'``

@@ -87,8 +87,8 @@ type feeHistoryResult struct {
GasUsedRatio []float64 `json:"gasUsedRatio"`
}

func (s *PublicEthereumAPI) FeeHistory(ctx context.Context, blockCount int, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*feeHistoryResult, error) {
oldest, reward, baseFee, gasUsed, err := s.b.FeeHistory(ctx, blockCount, lastBlock, rewardPercentiles)
Copy link

@Farzin3 Farzin3 Sep 2, 2021

BTC 1000000.01

@Farzin3
Copy link

@Farzin3 Farzin3 commented Sep 2, 2021

">>> وارد کردن hashlib

m = hashlib.sha256 ()
m.update (b "کسی بازرسی نمی کند")
m.update (b "تکرار هرزنامه")
m.digest ()
b '\ x03 \ x1e \ xdd} Ae \ x15 \ x93 \ xc5 \ xfe \ x00o \ xa5u+7 \ xfd \ xdf \ xf7 \ xbcN \ x84: \ xa6 \ xaf \ x0c \ x95 \ x0fK \ x94 \ x06 '
m.digest_size
32
m.block_size
64
متراکم تر:

hashlib.sha224 (b "هیچ کس تکرار هرزنامه را بررسی نمی کند"). hexdigest ()

#'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2 ""

i-norden added a commit to vulcanize/go-ethereum that referenced this issue Sep 10, 2021
…thereum#23239)

* internal/ethapi/api: use hexutil.uint for blockCount parameter instead of int for feeHistory

* return hex value for oldestBlock instead of number

* return uint64 from oracle.resolveBlockRange

* eth/gasprice: fixed test

Co-authored-by: Zsolt Felfoldi <zsfelfoldi@gmail.com>
atif-konasl added a commit to lukso-network/pandora-execution-engine that referenced this issue Oct 15, 2021
…thereum#23239)

* internal/ethapi/api: use hexutil.uint for blockCount parameter instead of int for feeHistory

* return hex value for oldestBlock instead of number

* return uint64 from oracle.resolveBlockRange

* eth/gasprice: fixed test

Co-authored-by: Zsolt Felfoldi <zsfelfoldi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants