Change native execution value to Gwei Uint64 (#12291)

* Default value to uint64

* Fix spectest

* Fix tests

* Fix tests

* Fix tests

* Fix test

* Fix test

* Fix build

* Potuz feedback

* Add test

* Fix test

* Fix test
This commit is contained in:
terencechain
2023-04-22 09:44:28 +09:00
committed by GitHub
parent 97a32e1b72
commit 08d6eccfb3
27 changed files with 118 additions and 221 deletions

View File

@@ -3,6 +3,7 @@ package math_test
import (
"fmt"
stdmath "math"
"math/big"
"testing"
"github.com/prysmaticlabs/prysm/v4/math"
@@ -549,3 +550,20 @@ func TestAddInt(t *testing.T) {
})
}
}
func TestWeiToGwei(t *testing.T) {
tests := []struct {
v *big.Int
want uint64
}{
{big.NewInt(1e9 - 1), 0},
{big.NewInt(1e9), 1},
{big.NewInt(1e10), 10},
{big.NewInt(239489233849348394), 239489233},
}
for _, tt := range tests {
if got := math.WeiToGwei(tt.v); got != tt.want {
t.Errorf("WeiToGwei() = %v, want %v", got, tt.want)
}
}
}