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

Merge for new Consensus (Kerleano v2.0) #37

Merged
merged 49 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d0dc349
graphql: return correct logs for tx (#25612)
s1na Aug 31, 2022
3b41be6
graphql: fixes missing tx logs (#25745)
s1na Sep 13, 2022
972007a
Release Geth v1.10.24
karalabe Sep 14, 2022
8f61fc8
params: set TerminalTotalDifficultyPassed to true (#25769)
MariusVanDerWijden Sep 15, 2022
69568c5
params: release Geth v1.10.25
karalabe Sep 15, 2022
172eed6
Branch to reproduce addr error on new 102 contract
Oct 26, 2022
ff33127
Created attempt2 raceRanking
Oct 26, 2022
d5ab7fe
Updated logs to get racerank issue while mining
Oct 26, 2022
a3afa83
Updated protocol
Oct 26, 2022
cf73366
Changed big.float rounding and updated unit tests
Oct 27, 2022
ec564bb
Reversed to light test SC Footprint contract
Oct 28, 2022
e831243
Fixed UnitTests in carbonfootprint_test
Oct 28, 2022
44d7da6
Added 2 tests
Oct 28, 2022
de6de20
Fee pot algo with links
Oct 28, 2022
d12d8b3
did plumbing to allow the Engine to manage fees
Oct 31, 2022
e7bdae0
Plugged fee management interface FeeManagementEngine
Oct 31, 2022
fe0aae0
Fixed interface boxing
Oct 31, 2022
a381edb
Added logs
Oct 31, 2022
469c11d
Changed FeeManagementEngine interface implementation
Oct 31, 2022
87dfcab
New interface boxing test
Oct 31, 2022
01695b3
Improved logs
Oct 31, 2022
7a50b21
Improved logs
Oct 31, 2022
82bae61
Added the beacon chain proxy handling
Oct 31, 2022
85e469f
eth/protocols/snap: fix problems due to idle-but-busy peers (#25651)
holiman Aug 31, 2022
937ea49
eth/protocols/snap: throttle trie heal requests when peers DoS us (#2…
karalabe Sep 9, 2022
a32e69a
trie: check childrens' existence concurrently for snap heal (#25694)
karalabe Sep 6, 2022
99bbb33
eth: fix a rare datarace on CHT challenge reply / shutdown (#25831)
karalabe Sep 20, 2022
27600a5
eth/filters: change filter block to be by-ref (#26054)
holiman Oct 27, 2022
211dbb7
rpc: handle wrong HTTP batch response length (#26064)
jmank88 Nov 2, 2022
e5eb32a
params: release geth v1.10.26 stable
fjl Nov 3, 2022
49fbf31
Augment fee info passed to the engine
guenoledc Nov 5, 2022
bdd6ecc
Merge branch 'ModularRewardComputation2' into v7-impl
guenoledc Nov 5, 2022
ad43e03
Refacto and impl
guenoledc Nov 6, 2022
baf240b
Add fee adjustment in the block processing
guenoledc Nov 6, 2022
007535e
Remove some logs and dead code
guenoledc Nov 6, 2022
6f18a51
small comment
guenoledc Nov 6, 2022
5f6fe3a
Remove ManageFees Interface that is not needed
guenoledc Nov 10, 2022
3d8f3d4
improve PoCR integration in geth
guenoledc Nov 11, 2022
f498327
Fix unit testing
guenoledc Nov 11, 2022
a893a18
verify build in github
guenoledc Nov 11, 2022
84ac2e9
Github hosted
guenoledc Nov 11, 2022
42ea340
Rebuild
guenoledc Nov 11, 2022
72740c9
Bring unit test in
guenoledc Nov 11, 2022
7da6ce5
deactivate build for this branch
guenoledc Nov 11, 2022
f0b54e1
remove logs
guenoledc Nov 15, 2022
3aba6f0
manage the synchro to the smart contract storage
guenoledc Nov 16, 2022
cae6de2
Merge remote-tracking branch 'ethereum/release/1.10' into merging-par…
guenoledc Nov 16, 2022
77258e6
add link to disable preseal issue
guenoledc Nov 16, 2022
69bbb51
Add the PoCR versioning
guenoledc Dec 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-and-publish-geth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build:
runs-on: self-hosted
runs-on: ubuntu-20.04

container:
image: golang:latest
Expand All @@ -30,7 +30,7 @@ jobs:
- name: publish geth latest version
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
repo_token: ${{ github.token }}
file: build/bin/geth
asset_name: geth
tag: ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM
vmEnv := vm.NewEVM(evmContext, txContext, stateDB, b.config, vm.Config{NoBaseFee: true})
gasPool := new(core.GasPool).AddGas(math.MaxUint64)

return core.NewStateTransition(vmEnv, msg, gasPool).TransitionDb()
return core.NewStateTransition(vmEnv, msg, gasPool).TransitionDb(b.blockchain.Engine())
}

// SendTransaction updates the pending block to include the given transaction.
Expand Down
1 change: 0 additions & 1 deletion consensus/beacon/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"errors"
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/misc"
Expand Down
16 changes: 8 additions & 8 deletions consensus/clique/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error) {
if header == nil {
return nil, errUnknownBlock
}
return api.Clique.snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
return api.Clique.Snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
}

// GetSnapshotAtHash retrieves the state snapshot at a given block.
Expand All @@ -57,7 +57,7 @@ func (api *API) GetSnapshotAtHash(hash common.Hash) (*Snapshot, error) {
if header == nil {
return nil, errUnknownBlock
}
return api.Clique.snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
return api.Clique.Snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
}

// GetSigners retrieves the list of authorized signers at the specified block.
Expand All @@ -73,11 +73,11 @@ func (api *API) GetSigners(number *rpc.BlockNumber) ([]common.Address, error) {
if header == nil {
return nil, errUnknownBlock
}
snap, err := api.Clique.snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
snap, err := api.Clique.Snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
if err != nil {
return nil, err
}
return snap.signers(), nil
return snap.GetSigners(), nil
}

// GetSignersAtHash retrieves the list of authorized signers at the specified block.
Expand All @@ -86,11 +86,11 @@ func (api *API) GetSignersAtHash(hash common.Hash) ([]common.Address, error) {
if header == nil {
return nil, errUnknownBlock
}
snap, err := api.Clique.snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
snap, err := api.Clique.Snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
if err != nil {
return nil, err
}
return snap.signers(), nil
return snap.GetSigners(), nil
}

// Proposals returns the current proposals the node tries to uphold and vote on.
Expand Down Expand Up @@ -140,12 +140,12 @@ func (api *API) Status() (*status, error) {
diff = uint64(0)
optimals = 0
)
snap, err := api.Clique.snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
snap, err := api.Clique.Snapshot(api.Chain, header.Number.Uint64(), header.Hash(), nil)
if err != nil {
return nil, err
}
var (
signers = snap.signers()
signers = snap.GetSigners()
end = header.Number.Uint64()
start = end - numBlocks
)
Expand Down
23 changes: 15 additions & 8 deletions consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ var (
// SignerFn hashes and signs the data to be signed by a backing account.
type SignerFn func(signer accounts.Account, mimeType string, message []byte) ([]byte, error)

// Declare an interface for the Clique engine
type CliqueEngine interface {
consensus.Engine

Authorize(signer common.Address, signFn SignerFn)
}

// ecrecover extracts the Ethereum account address from a signed header.
func ecrecover(header *types.Header, sigcache *lru.ARCCache) (common.Address, error) {
// If the signature's already cached, return that
Expand Down Expand Up @@ -346,14 +353,14 @@ func (c *Clique) verifyCascadingFields(chain consensus.ChainHeaderReader, header
return err
}
// Retrieve the snapshot needed to verify this header and cache it
snap, err := c.snapshot(chain, number-1, header.ParentHash, parents)
snap, err := c.Snapshot(chain, number-1, header.ParentHash, parents)
if err != nil {
return err
}
// If the block is a checkpoint block, verify the signer list
if number%c.config.Epoch == 0 {
signers := make([]byte, len(snap.Signers)*common.AddressLength)
for i, signer := range snap.signers() {
for i, signer := range snap.GetSigners() {
copy(signers[i*common.AddressLength:], signer[:])
}
extraSuffix := len(header.Extra) - extraSeal
Expand All @@ -365,8 +372,8 @@ func (c *Clique) verifyCascadingFields(chain consensus.ChainHeaderReader, header
return c.verifySeal(snap, header, parents)
}

// snapshot retrieves the authorization snapshot at a given point in time.
func (c *Clique) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) {
// Snapshot retrieves the authorization Snapshot at a given point in time.
func (c *Clique) Snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) {
// Search for a snapshot in memory or on disk for checkpoints
var (
headers []*types.Header
Expand Down Expand Up @@ -503,7 +510,7 @@ func (c *Clique) Prepare(chain consensus.ChainHeaderReader, header *types.Header

number := header.Number.Uint64()
// Assemble the voting snapshot to check which votes make sense
snap, err := c.snapshot(chain, number-1, header.ParentHash, nil)
snap, err := c.Snapshot(chain, number-1, header.ParentHash, nil)
if err != nil {
return err
}
Expand Down Expand Up @@ -542,7 +549,7 @@ func (c *Clique) Prepare(chain consensus.ChainHeaderReader, header *types.Header
header.Extra = header.Extra[:extraVanity]

if number%c.config.Epoch == 0 {
for _, signer := range snap.signers() {
for _, signer := range snap.GetSigners() {
header.Extra = append(header.Extra, signer[:]...)
}
}
Expand Down Expand Up @@ -611,7 +618,7 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
c.lock.RUnlock()

// Bail out if we're unauthorized to sign a block
snap, err := c.snapshot(chain, number-1, header.ParentHash, nil)
snap, err := c.Snapshot(chain, number-1, header.ParentHash, nil)
if err != nil {
return err
}
Expand Down Expand Up @@ -666,7 +673,7 @@ func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
// * DIFF_NOTURN(2) if BLOCK_NUMBER % SIGNER_COUNT != SIGNER_INDEX
// * DIFF_INTURN(1) if BLOCK_NUMBER % SIGNER_COUNT == SIGNER_INDEX
func (c *Clique) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int {
snap, err := c.snapshot(chain, parent.Number.Uint64(), parent.Hash(), nil)
snap, err := c.Snapshot(chain, parent.Number.Uint64(), parent.Hash(), nil)
if err != nil {
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions consensus/clique/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) {
return snap, nil
}

// signers retrieves the list of authorized signers in ascending order.
func (s *Snapshot) signers() []common.Address {
// GetSigners retrieves the list of authorized GetSigners in ascending order.
func (s *Snapshot) GetSigners() []common.Address {
sigs := make([]common.Address, 0, len(s.Signers))
for sig := range s.Signers {
sigs = append(sigs, sig)
Expand All @@ -318,7 +318,7 @@ func (s *Snapshot) signers() []common.Address {

// inturn returns if a signer at a given block height is in-turn or not.
func (s *Snapshot) inturn(number uint64, signer common.Address) bool {
signers, offset := s.signers(), 0
signers, offset := s.GetSigners(), 0
for offset < len(signers) && signers[offset] != signer {
offset++
}
Expand Down
4 changes: 2 additions & 2 deletions consensus/clique/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ func TestClique(t *testing.T) {
// No failure was produced or requested, generate the final voting snapshot
head := blocks[len(blocks)-1]

snap, err := engine.snapshot(chain, head.NumberU64(), head.Hash(), nil)
snap, err := engine.Snapshot(chain, head.NumberU64(), head.Hash(), nil)
if err != nil {
t.Errorf("test %d: failed to retrieve voting snapshot: %v", i, err)
continue
Expand All @@ -492,7 +492,7 @@ func TestClique(t *testing.T) {
}
}
}
result := snap.signers()
result := snap.GetSigners()
if len(result) != len(signers) {
t.Errorf("test %d: signers mismatch: have %x, want %x", i, result, signers)
continue
Expand Down
69 changes: 0 additions & 69 deletions consensus/cliquepcr/carbonfootprint_test.go

This file was deleted.

Loading