Skip to content

Commit

Permalink
Revert format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyonur committed Feb 25, 2025
1 parent 6b5e83b commit ff7c334
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
8 changes: 5 additions & 3 deletions core/txpool/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ import (
"github.com/ava-labs/libevm/log"
)

// blobTxMinBlobGasPrice is the big.Int version of the configured protocol
// parameter to avoid constucting a new big integer for every transaction.
var blobTxMinBlobGasPrice = big.NewInt(params.BlobTxMinBlobGasprice)
var (
// blobTxMinBlobGasPrice is the big.Int version of the configured protocol
// parameter to avoid constucting a new big integer for every transaction.
blobTxMinBlobGasPrice = big.NewInt(params.BlobTxMinBlobGasprice)
)

// ValidationOptions define certain differences between transaction validation
// across the different pools without having to duplicate those checks.
Expand Down
1 change: 1 addition & 0 deletions nativeasset/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func (c *NativeAssetCall) run(env vm.PrecompileEnvironment, stateDB contract.Sta
stateDB.AddBalanceMultiCoin(to, assetID, assetAmount)

ret, err = env.Call(to, callData, env.Gas(), new(uint256.Int), vm.WithUNSAFECallerAddressProxying())

// When an error was returned by the EVM or when setting the creation code
// above we revert to the snapshot and consume any gas remaining. Additionally
// when we're in homestead this also counts for code storage gas errors.
Expand Down
10 changes: 5 additions & 5 deletions plugin/evm/atomic/state/atomic_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type AtomicBackend struct {
sharedMemory avalancheatomic.SharedMemory

repo *AtomicRepository
atomicTrie *AtomicTrie
atomicTrie *atomicTrie

Check failure on line 35 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: atomicTrie

Check failure on line 35 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: atomicTrie

Check failure on line 35 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (macos-latest)

undefined: atomicTrie

Check failure on line 35 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-20.04)

undefined: atomicTrie

Check failure on line 35 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-latest)

undefined: atomicTrie

Check failure on line 35 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (windows-latest)

undefined: atomicTrie

lastAcceptedHash common.Hash
verifiedRoots map[common.Hash]*atomicState
Expand All @@ -50,6 +50,9 @@ func NewAtomicBackend(
if err != nil {
return nil, err
}
if bonusBlocks == nil {
bonusBlocks = make(map[uint64]ids.ID) // Ensure it's always non-nil
}
atomicBackend := &AtomicBackend{
codec: codec,
sharedMemory: sharedMemory,
Expand Down Expand Up @@ -398,7 +401,7 @@ func (a *AtomicBackend) IsBonus(blockHeight uint64, blockHash common.Hash) bool
return false
}

func (a *AtomicBackend) AtomicTrie() *AtomicTrie {
func (a *AtomicBackend) AtomicTrie() *atomicTrie {

Check failure on line 404 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: atomicTrie

Check failure on line 404 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: atomicTrie) (typecheck)

Check failure on line 404 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (macos-latest)

undefined: atomicTrie

Check failure on line 404 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-20.04)

undefined: atomicTrie

Check failure on line 404 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-latest)

undefined: atomicTrie

Check failure on line 404 in plugin/evm/atomic/state/atomic_backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (windows-latest)

undefined: atomicTrie
return a.atomicTrie
}

Expand Down Expand Up @@ -437,8 +440,5 @@ func mergeAtomicOpsToMap(output map[ids.ID]*avalancheatomic.Requests, chainID id

// AddBonusBlock adds a bonus block to the atomic backend
func (a *AtomicBackend) AddBonusBlock(height uint64, blockID ids.ID) {
if a.bonusBlocks == nil {
a.bonusBlocks = make(map[uint64]ids.ID)
}
a.bonusBlocks[height] = blockID
}
8 changes: 4 additions & 4 deletions plugin/evm/atomic/state/atomic_trie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const testCommitInterval = 100
// indexAtomicTxs updates [tr] with entries in [atomicOps] at height by creating
// a new snapshot, calculating a new root, and calling InsertTrie followed
// by AcceptTrie on the new root.
func indexAtomicTxs(tr *AtomicTrie, height uint64, atomicOps map[ids.ID]*avalancheatomic.Requests) error {
func indexAtomicTxs(tr *atomicTrie, height uint64, atomicOps map[ids.ID]*avalancheatomic.Requests) error {

Check failure on line 41 in plugin/evm/atomic/state/atomic_trie_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: atomicTrie
snapshot, err := tr.OpenTrie(tr.LastAcceptedRoot())
if err != nil {
return err
Expand Down Expand Up @@ -255,7 +255,7 @@ func TestIndexerInitializesOnlyOnce(t *testing.T) {
assert.Equal(t, hash, newHash, "hash should be the same")
}

func newTestAtomicTrie(t *testing.T) *AtomicTrie {
func newTestAtomicTrie(t *testing.T) *atomicTrie {

Check failure on line 258 in plugin/evm/atomic/state/atomic_trie_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: atomicTrie
db := versiondb.New(memdb.New())
repo, err := NewAtomicTxRepository(db, atomictest.TestTxCodec, 0)
if err != nil {
Expand Down Expand Up @@ -692,7 +692,7 @@ func BenchmarkAtomicTrieInit(b *testing.B) {
writeTxs(b, repo, 1, lastAcceptedHeight, constTxsPerHeight(3), nil, operationsMap)

var (
atomicTrie *AtomicTrie
atomicTrie *atomicTrie

Check failure on line 695 in plugin/evm/atomic/state/atomic_trie_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: atomicTrie
hash common.Hash
height uint64
)
Expand Down Expand Up @@ -828,7 +828,7 @@ func benchmarkApplyToSharedMemory(b *testing.B, disk database.Database, blocks u

// verifyOperations creates an iterator over the atomicTrie at [rootHash] and verifies that the all of the operations in the trie in the interval [from, to] are identical to
// the atomic operations contained in [operationsMap] on the same interval.
func verifyOperations(t testing.TB, atomicTrie *AtomicTrie, codec codec.Manager, rootHash common.Hash, from, to uint64, operationsMap map[uint64]map[ids.ID]*avalancheatomic.Requests) {
func verifyOperations(t testing.TB, atomicTrie *atomicTrie, codec codec.Manager, rootHash common.Hash, from, to uint64, operationsMap map[uint64]map[ids.ID]*avalancheatomic.Requests) {

Check failure on line 831 in plugin/evm/atomic/state/atomic_trie_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: atomicTrie (typecheck)
t.Helper()

// Start the iterator at [from]
Expand Down
5 changes: 3 additions & 2 deletions plugin/evm/atomic/vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,9 @@ func (vm *VM) onExtraStateChange(block *types.Block, state *state.StateDB, chain
batchContribution *big.Int = big.NewInt(0)
batchGasUsed *big.Int = big.NewInt(0)
header = block.Header()
rules = chainConfig.Rules(header.Number, params.IsMergeTODO, header.Time)
rulesExtra = *params.GetRulesExtra(rules)
// We cannot use chain config from InnerVM since it's not available when this function is called for the first time (bc.loadLastState).
rules = chainConfig.Rules(header.Number, params.IsMergeTODO, header.Time)
rulesExtra = *params.GetRulesExtra(rules)
)

txs, err := atomic.ExtractAtomicTxs(block.ExtData(), rulesExtra.IsApricotPhase5, atomic.Codec)
Expand Down
1 change: 0 additions & 1 deletion precompile/contracts/warp/contract_warp_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/vms/platformvm/warp"
"github.com/ava-labs/avalanchego/vms/platformvm/warp/payload"

"github.com/ava-labs/coreth/precompile/contract"
"github.com/ava-labs/coreth/predicate"
"github.com/ava-labs/coreth/vmerrs"
Expand Down

0 comments on commit ff7c334

Please sign in to comment.