From 8cc634a16c4297dce2cd3c054e86942194b81ad0 Mon Sep 17 00:00:00 2001 From: Huan-Cheng Chang Date: Wed, 29 May 2024 13:44:41 +0100 Subject: [PATCH 01/13] update protocol v19 hash to paris b2 --- CHANGELOG.md | 3 +++ tezos/protocols.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4715724a..fed17455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v1.19.1 +* Update Paris protocol to [ParisB2](https://research-development.nomadic-labs.com/parisB2-announcement.html) + ## v1.19.0 * BREAKING CHANGE: The cannonical import part has been changed from `blockwatch.cc` to `github.com/trilitech` diff --git a/tezos/protocols.go b/tezos/protocols.go index 1c07f53b..5f7110ba 100644 --- a/tezos/protocols.go +++ b/tezos/protocols.go @@ -25,7 +25,7 @@ var ( ProtoV016_2 = MustParseProtocolHash("PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1") ProtoV017 = MustParseProtocolHash("PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf") ProtoV018 = MustParseProtocolHash("ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH") - ProtoV019 = MustParseProtocolHash("PtParisBQscdCm6Cfow6ndeU6wKJyA3aV1j4D3gQBQMsTQyJCrz") + ProtoV019 = MustParseProtocolHash("PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ") // aliases PtAthens = ProtoV004 From f11fd4ea441532cc9916a09275355317cf3e7016 Mon Sep 17 00:00:00 2001 From: huancheng-trili <168652455+huancheng-trili@users.noreply.github.com> Date: Fri, 31 May 2024 09:30:30 +0100 Subject: [PATCH 02/13] Update parisnet hash and ghostnet history (#4) * update parisnet hash * update protocol history --- CHANGELOG.md | 4 ++++ tezos/protocols.go | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fed17455..58899e8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.19.2 +* Update Parisnet hash +* Update protocol history of ghostnet + ## v1.19.1 * Update Paris protocol to [ParisB2](https://research-development.nomadic-labs.com/parisB2-announcement.html) diff --git a/tezos/protocols.go b/tezos/protocols.go index 5f7110ba..bfec6168 100644 --- a/tezos/protocols.go +++ b/tezos/protocols.go @@ -49,7 +49,7 @@ var ( Ghostnet = MustParseChainIdHash("NetXnHfVqm9iesp") Nairobinet = MustParseChainIdHash("NetXyuzvDo2Ugzb") Oxfordnet = MustParseChainIdHash("NetXxWsskGahzQB") - Parisnet = MustParseChainIdHash("NetXo8SqH1c38SS") + Parisnet = MustParseChainIdHash("NetXR64bNAYkP4S") Versions = map[ProtocolHash]int{ ProtoGenesis: 0, @@ -110,8 +110,8 @@ var ( {PtLimaPt, 0, 1654785, 2162688, 404, 3, 4096, 256}, // v15 {PtMumbai, 0, 2162689, 2957312, 528, 3, 8192, 512}, // v16 {PtNairobi, 0, 2957313, 5316608, 625, 3, 8192, 512}, // v17 - {Proxford, 0, 5316609, -1, 913, 3, 8192, 512}, // v18 - // {PtParisB, 0, 5316609, -1, 913, 3, 8192, 8192}, // v19 + {Proxford, 0, 5316609, 6422528, 913, 3, 8192, 512}, // v18 + {PtParisB, 0, 6422529, -1, 1048, 3, 12288, 12288}, // v19 }, Nairobinet: { {ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512}, // 0 From 3bf7c32361c069b36a20b44404f7e5f94b803a68 Mon Sep 17 00:00:00 2001 From: Frank-en-stein Date: Fri, 31 May 2024 18:35:40 +0100 Subject: [PATCH 03/13] fix snapshot calculation and ghostnet params --- rpc/constants.go | 5 +++++ tezos/param_test.go | 6 +++--- tezos/params.go | 5 +++++ tezos/protocols.go | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/rpc/constants.go b/rpc/constants.go index cc6a28f5..51b03ff8 100644 --- a/rpc/constants.go +++ b/rpc/constants.go @@ -101,6 +101,11 @@ func (c Constants) MapToChainParams() *tezos.Params { MinimalBlockDelay: time.Duration(c.MinimalBlockDelay) * time.Second, } + // Paris blocks per snapshot + if p.BlocksPerSnapshot == 0 { + p.BlocksPerSnapshot = c.BlocksPerCycle + } + // backport preserved cycles if p.ConsensusRightsDelay == 0 { p.ConsensusRightsDelay = c.PreservedCycles diff --git a/tezos/param_test.go b/tezos/param_test.go index f4ceb303..b0b08ffa 100644 --- a/tezos/param_test.go +++ b/tezos/param_test.go @@ -756,7 +756,7 @@ var paramBlocks = []BlockMetadata{ LevelInfo: &LevelInfo{ Level: 3760128, Cycle: 622, - CyclePosition: 8191, + CyclePosition: 16383, ExpectedCommitment: true, }, VotingPeriodInfo: &VotingPeriodInfo{ @@ -784,7 +784,7 @@ var paramBlocks = []BlockMetadata{ LevelInfo: &LevelInfo{ Level: 5070848, Cycle: 702, - CyclePosition: 8191, + CyclePosition: 16383, ExpectedCommitment: true, }, VotingPeriodInfo: &VotingPeriodInfo{ @@ -812,7 +812,7 @@ var paramBlocks = []BlockMetadata{ LevelInfo: &LevelInfo{ Level: 5726208, Cycle: 742, - CyclePosition: 8191, + CyclePosition: 16383, ExpectedCommitment: true, }, VotingPeriodInfo: &VotingPeriodInfo{ diff --git a/tezos/params.go b/tezos/params.go index 6e8b555f..c3748647 100644 --- a/tezos/params.go +++ b/tezos/params.go @@ -295,6 +295,11 @@ func (p *Params) IsCycleEnd(height int64) bool { } func (p *Params) IsSnapshotBlock(height int64) bool { + // no more snapshots in Paris + if p.Version > 18 && p.IsCycleEnd(height) { + return true + } + // adjust to target height at := p.AtBlock(height) pos := at.CyclePosition(height) + 1 diff --git a/tezos/protocols.go b/tezos/protocols.go index bfec6168..286fb8af 100644 --- a/tezos/protocols.go +++ b/tezos/protocols.go @@ -111,7 +111,7 @@ var ( {PtMumbai, 0, 2162689, 2957312, 528, 3, 8192, 512}, // v16 {PtNairobi, 0, 2957313, 5316608, 625, 3, 8192, 512}, // v17 {Proxford, 0, 5316609, 6422528, 913, 3, 8192, 512}, // v18 - {PtParisB, 0, 6422529, -1, 1048, 3, 12288, 12288}, // v19 + {PtParisB, 0, 6422529, -1, 1048, 2, 12288, 12288}, // v19 }, Nairobinet: { {ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512}, // 0 From 4cb785712494a33a5b2c695c3169b54214c808ea Mon Sep 17 00:00:00 2001 From: Frank-en-stein Date: Fri, 31 May 2024 19:22:45 +0100 Subject: [PATCH 04/13] Fix parisnet start height in params --- tezos/protocols.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tezos/protocols.go b/tezos/protocols.go index 286fb8af..9931479a 100644 --- a/tezos/protocols.go +++ b/tezos/protocols.go @@ -126,10 +126,10 @@ var ( {Proxford, 0, 16385, -1, 2, 3, 8192, 512}, // v18 }, Parisnet: { - {ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512}, // 0 - {ProtoBootstrap, 0, 1, 1, 0, 3, 8192, 512}, // 0 - {Proxford, 2, 2, 16384, 0, 3, 8192, 512}, // v18 - {PtParisB, 0, 16385, -1, 2, 2, 12288, 12288}, // v19 + {ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512}, // 0 + {ProtoBootstrap, 0, 1, 1, 0, 3, 8192, 512}, // 0 + {Proxford, 2, 2, 8192, 0, 3, 8192, 512}, // v18 + {PtParisB, 0, 8193, -1, 2, 2, 12288, 12288}, // v19 }, } ) From d25bba57202d1aa09f29d07e1cfda43bf83d82e3 Mon Sep 17 00:00:00 2001 From: Frank-en-stein Date: Fri, 31 May 2024 19:30:00 +0100 Subject: [PATCH 05/13] Update tezos/protocols.go parisnet params Co-authored-by: huancheng-trili <168652455+huancheng-trili@users.noreply.github.com> --- tezos/protocols.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tezos/protocols.go b/tezos/protocols.go index 9931479a..3279ed99 100644 --- a/tezos/protocols.go +++ b/tezos/protocols.go @@ -129,7 +129,7 @@ var ( {ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512}, // 0 {ProtoBootstrap, 0, 1, 1, 0, 3, 8192, 512}, // 0 {Proxford, 2, 2, 8192, 0, 3, 8192, 512}, // v18 - {PtParisB, 0, 8193, -1, 2, 2, 12288, 12288}, // v19 + {PtParisB, 0, 8193, -1, 1, 2, 12288, 12288}, // v19 }, } ) From 7a39642acca2d92efcf2c0c5927968b87a1d6cf9 Mon Sep 17 00:00:00 2001 From: Frank-en-stein Date: Wed, 5 Jun 2024 17:22:58 +0100 Subject: [PATCH 06/13] Micheline codec fix --- micheline/primitives.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/micheline/primitives.go b/micheline/primitives.go index 13ea3677..669327ca 100644 --- a/micheline/primitives.go +++ b/micheline/primitives.go @@ -1494,6 +1494,9 @@ func (p *Prim) DecodeBuffer(buf *bytes.Buffer) error { p.Args = append(p.Args, prim) } // annotation array byte size + if buf.Len() < 4 { + return io.ErrShortBuffer + } size = int(binary.BigEndian.Uint32(buf.Next(4))) if buf.Len() < size { return io.ErrShortBuffer From 28adec711c6ac56c09eb1766386333fb61de4eb0 Mon Sep 17 00:00:00 2001 From: Frank-en-stein Date: Thu, 13 Jun 2024 10:21:37 +0100 Subject: [PATCH 07/13] Params SnapshotBlock bounding fix --- tezos/params.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tezos/params.go b/tezos/params.go index c3748647..d02de079 100644 --- a/tezos/params.go +++ b/tezos/params.go @@ -265,7 +265,8 @@ func (p *Params) CycleFromHeight(height int64) int64 { func (p *Params) CycleStartHeight(c int64) int64 { // adjust to target cycle at := p.AtCycle(c) - return at.StartHeight - at.StartOffset + (c-at.StartCycle)*at.BlocksPerCycle + res := at.StartHeight - at.StartOffset + (c-at.StartCycle)*at.BlocksPerCycle + return res } func (p *Params) CycleEndHeight(c int64) int64 { @@ -313,7 +314,11 @@ func (p *Params) SnapshotBlock(cycle int64, index int) int64 { if base < 0 { return 0 } - return at.CycleStartHeight(base) + int64(index+1)*at.BlocksPerSnapshot - 1 + offset := int64(index+1) * at.BlocksPerSnapshot + if offset > at.BlocksPerCycle { + offset = at.BlocksPerCycle + } + return at.CycleStartHeight(base) + offset - 1 } func (p *Params) SnapshotIndex(height int64) int { From 9193d1b69c0a8e3242ee7801bc3beebe79283ed7 Mon Sep 17 00:00:00 2001 From: huancheng-trili <168652455+huancheng-trili@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:48:53 +0100 Subject: [PATCH 08/13] Support baker_own_stake and baker_edge in balance update (#9) --- rpc/balance.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rpc/balance.go b/rpc/balance.go index 232d482d..44317965 100644 --- a/rpc/balance.go +++ b/rpc/balance.go @@ -34,9 +34,11 @@ type BalanceUpdate struct { // Oxford staking Staker struct { - Contract tezos.Address `json:"contract"` // tz1/2/3 accounts (only stake, unstake) - Delegate tezos.Address `json:"delegate"` // baker - Baker tezos.Address `json:"baker"` // baker + Contract tezos.Address `json:"contract"` // tz1/2/3 accounts (only stake, unstake) + Delegate tezos.Address `json:"delegate"` // baker + Baker tezos.Address `json:"baker"` // baker + BakerOwnStake tezos.Address `json:"baker_own_stake"` // baker: replaced baker in v19 + BakerEdge tezos.Address `json:"baker_edge"` // baker: new in v19 } `json:"staker"` DelayedOp tezos.OpHash `json:"delayed_operation_hash"` } @@ -83,6 +85,10 @@ func (b BalanceUpdate) Address() tezos.Address { return b.Staker.Delegate case b.Staker.Baker.IsValid(): return b.Staker.Baker + case b.Staker.BakerOwnStake.IsValid(): + return b.Staker.BakerOwnStake + case b.Staker.BakerEdge.IsValid(): + return b.Staker.BakerEdge } return tezos.Address{} } From 32cae2559148fade38883ea89a2cc232d08fe963 Mon Sep 17 00:00:00 2001 From: V <36897290+cryi@users.noreply.github.com> Date: Sat, 15 Jun 2024 10:41:53 +0200 Subject: [PATCH 09/13] Fix ListActiveDelegates (#10) --- rpc/delegates.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc/delegates.go b/rpc/delegates.go index 283f5cd3..2148f982 100644 --- a/rpc/delegates.go +++ b/rpc/delegates.go @@ -72,7 +72,7 @@ func (c *Client) ListActiveDelegates(ctx context.Context, id BlockID) (DelegateL } selector := "active=true" if p.Version >= 13 { - selector = "with_minimal_stake=true" + selector += "&with_minimal_stake=true" } delegates := make(DelegateList, 0) u := fmt.Sprintf("chains/main/blocks/%s/context/delegates?%s", id, selector) From 05813d632ad4e78e3a824d79a14a529299a2e410 Mon Sep 17 00:00:00 2001 From: huancheng-trili <168652455+huancheng-trili@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:43:08 +0100 Subject: [PATCH 10/13] Add protocol hash for ParisC (#11) * parisc --- tezos/param_test.go | 6 ++--- tezos/params.go | 36 ++--------------------------- tezos/protocols.go | 55 +++++++++++++++++++++------------------------ 3 files changed, 30 insertions(+), 67 deletions(-) diff --git a/tezos/param_test.go b/tezos/param_test.go index b0b08ffa..6658359e 100644 --- a/tezos/param_test.go +++ b/tezos/param_test.go @@ -87,10 +87,8 @@ func TestParamsStatic(t *testing.T) { func TestDefaultParams(t *testing.T) { for n, p := range map[string]*tezos.Params{ - "main": tezos.DefaultParams, - "ghost": tezos.GhostnetParams, - "nairobi": tezos.NairobinetParams, - "oxford": tezos.OxfordnetParams, + "main": tezos.DefaultParams, + "ghost": tezos.GhostnetParams, } { if p.Network == "" { t.Errorf("%s params: Empty network name", n) diff --git a/tezos/params.go b/tezos/params.go index d02de079..ef0cc56d 100644 --- a/tezos/params.go +++ b/tezos/params.go @@ -40,36 +40,6 @@ var ( WithChainId(Ghostnet). WithDeployment(Deployments[Ghostnet].AtProtocol(ProtoV019)) - // NairobinetParams defines the blockchain configuration for Nairobi testnet. - // To produce compliant transactions, use these defaults in op.WithParams(). - NairobinetParams = (&Params{ - MinimalBlockDelay: 8 * time.Second, - CostPerByte: 250, - OriginationSize: 257, - HardGasLimitPerOperation: 1040000, - HardGasLimitPerBlock: 2600000, - HardStorageLimitPerOperation: 60000, - MaxOperationDataLength: 32768, - MaxOperationsTTL: 240, - }). - WithChainId(Nairobinet). - WithDeployment(Deployments[Nairobinet].AtProtocol(ProtoV017)) - - // OxfordnetParams defines the blockchain configuration for Oxford testnet. - // To produce compliant transactions, use these defaults in op.WithParams(). - OxfordnetParams = (&Params{ - MinimalBlockDelay: 8 * time.Second, - CostPerByte: 250, - OriginationSize: 257, - HardGasLimitPerOperation: 1040000, - HardGasLimitPerBlock: 2600000, - HardStorageLimitPerOperation: 60000, - MaxOperationDataLength: 32768, - MaxOperationsTTL: 240, - }). - WithChainId(Oxfordnet). - WithDeployment(Deployments[Oxfordnet].AtProtocol(ProtoV018)) - // ParisnetParams defines the blockchain configuration for Paris testnet. // To produce compliant transactions, use these defaults in op.WithParams(). ParisnetParams = (&Params{ @@ -141,12 +111,10 @@ func (p *Params) WithChainId(id ChainIdHash) *Params { p.Network = "Mainnet" case Ghostnet: p.Network = "Ghostnet" - case Nairobinet: - p.Network = "Nairobinet" - case Oxfordnet: - p.Network = "Oxfordnet" case Parisnet: p.Network = "Parisnet" + case ParisCnet: + p.Network = "ParisCnet" } } return p diff --git a/tezos/protocols.go b/tezos/protocols.go index 3279ed99..e1dc60a5 100644 --- a/tezos/protocols.go +++ b/tezos/protocols.go @@ -26,6 +26,7 @@ var ( ProtoV017 = MustParseProtocolHash("PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf") ProtoV018 = MustParseProtocolHash("ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH") ProtoV019 = MustParseProtocolHash("PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ") + ProtoV019_2 = MustParseProtocolHash("PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi") // aliases PtAthens = ProtoV004 @@ -44,12 +45,12 @@ var ( PtNairobi = ProtoV017 Proxford = ProtoV018 PtParisB = ProtoV019 + PsParisC = ProtoV019_2 - Mainnet = MustParseChainIdHash("NetXdQprcVkpaWU") - Ghostnet = MustParseChainIdHash("NetXnHfVqm9iesp") - Nairobinet = MustParseChainIdHash("NetXyuzvDo2Ugzb") - Oxfordnet = MustParseChainIdHash("NetXxWsskGahzQB") - Parisnet = MustParseChainIdHash("NetXR64bNAYkP4S") + Mainnet = MustParseChainIdHash("NetXdQprcVkpaWU") + Ghostnet = MustParseChainIdHash("NetXnHfVqm9iesp") + Parisnet = MustParseChainIdHash("NetXR64bNAYkP4S") + ParisCnet = MustParseChainIdHash("NetXXWAHLEvre9b") Versions = map[ProtocolHash]int{ ProtoGenesis: 0, @@ -73,6 +74,7 @@ var ( ProtoV017: 17, ProtoV018: 18, ProtoV019: 19, + ProtoV019_2: 19, ProtoAlpha: 20, } @@ -98,32 +100,22 @@ var ( {PtMumbai, 0, 3268609, 3760128, 593, 5, 16384, 1024}, // v16 {PtNairobi, 0, 3760129, 5070848, 623, 5, 16384, 1024}, // v17 {Proxford, 0, 5070849, 5726208, 703, 5, 16384, 1024}, // v18 - {PtParisB, 0, 5726209, -1, 743, 2, 24576, 24576}, // v19 + {PtParisB, 0, 5726209, 5898240, 743, 2, 24576, 24576}, // v19 + {PsParisC, 0, 5898241, -1, 750, 2, 24576, 24576}, // v19 }, Ghostnet: { - {ProtoGenesis, 0, 0, 0, 0, 3, 4096, 256}, // 0 - {ProtoBootstrap, 0, 1, 1, 0, 3, 4096, 256}, // 0 - {PtHangz2, 2, 2, 8191, 0, 3, 4096, 256}, // v11 - {Psithaca, 0, 8192, 765952, 2, 3, 4096, 256}, // v12 - {PtJakart, 0, 765953, 1191936, 187, 3, 4096, 256}, // v13 - {PtKathma, 0, 1191937, 1654784, 291, 3, 4096, 256}, // v14 - {PtLimaPt, 0, 1654785, 2162688, 404, 3, 4096, 256}, // v15 - {PtMumbai, 0, 2162689, 2957312, 528, 3, 8192, 512}, // v16 - {PtNairobi, 0, 2957313, 5316608, 625, 3, 8192, 512}, // v17 - {Proxford, 0, 5316609, 6422528, 913, 3, 8192, 512}, // v18 - {PtParisB, 0, 6422529, -1, 1048, 2, 12288, 12288}, // v19 - }, - Nairobinet: { - {ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512}, // 0 - {ProtoBootstrap, 0, 1, 1, 0, 3, 8192, 512}, // 0 - {PtMumbai, 2, 2, 16384, 0, 3, 8192, 512}, // v16 - {PtNairobi, 0, 16385, -1, 2, 3, 8192, 512}, // v17 - }, - Oxfordnet: { - {ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512}, // 0 - {ProtoBootstrap, 0, 1, 1, 0, 3, 8192, 512}, // 0 - {PtNairobi, 2, 2, 16384, 0, 3, 8192, 512}, // v17 - {Proxford, 0, 16385, -1, 2, 3, 8192, 512}, // v18 + {ProtoGenesis, 0, 0, 0, 0, 3, 4096, 256}, // 0 + {ProtoBootstrap, 0, 1, 1, 0, 3, 4096, 256}, // 0 + {PtHangz2, 2, 2, 8191, 0, 3, 4096, 256}, // v11 + {Psithaca, 0, 8192, 765952, 2, 3, 4096, 256}, // v12 + {PtJakart, 0, 765953, 1191936, 187, 3, 4096, 256}, // v13 + {PtKathma, 0, 1191937, 1654784, 291, 3, 4096, 256}, // v14 + {PtLimaPt, 0, 1654785, 2162688, 404, 3, 4096, 256}, // v15 + {PtMumbai, 0, 2162689, 2957312, 528, 3, 8192, 512}, // v16 + {PtNairobi, 0, 2957313, 5316608, 625, 3, 8192, 512}, // v17 + {Proxford, 0, 5316609, 6422528, 913, 3, 8192, 512}, // v18 + {PtParisB, 0, 6422529, 6729728, 1048, 2, 12288, 12288}, // v19 + {PsParisC, 0, 6729729, -1, 1073, 2, 12288, 12288}, // v19 }, Parisnet: { {ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512}, // 0 @@ -131,6 +123,11 @@ var ( {Proxford, 2, 2, 8192, 0, 3, 8192, 512}, // v18 {PtParisB, 0, 8193, -1, 1, 2, 12288, 12288}, // v19 }, + ParisCnet: { + {ProtoGenesis, 0, 0, 0, 0, 3, 8192, 512}, // 0 + {ProtoBootstrap, 0, 1, 1, 0, 3, 8192, 512}, // 0 + {PsParisC, 2, 2, -1, 0, 2, 128, 128}, // v19 + }, } ) From d9f2d8ffbec8eb3d11306fcdf76f57dfed4ec008 Mon Sep 17 00:00:00 2001 From: huancheng-trili <168652455+huancheng-trili@users.noreply.github.com> Date: Mon, 24 Jun 2024 09:38:11 +0100 Subject: [PATCH 11/13] Use version number 20 for ParisC (#12) --- tezos/protocols.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tezos/protocols.go b/tezos/protocols.go index e1dc60a5..3152c290 100644 --- a/tezos/protocols.go +++ b/tezos/protocols.go @@ -26,7 +26,7 @@ var ( ProtoV017 = MustParseProtocolHash("PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf") ProtoV018 = MustParseProtocolHash("ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH") ProtoV019 = MustParseProtocolHash("PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ") - ProtoV019_2 = MustParseProtocolHash("PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi") + ProtoV020 = MustParseProtocolHash("PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi") // aliases PtAthens = ProtoV004 @@ -45,7 +45,7 @@ var ( PtNairobi = ProtoV017 Proxford = ProtoV018 PtParisB = ProtoV019 - PsParisC = ProtoV019_2 + PsParisC = ProtoV020 Mainnet = MustParseChainIdHash("NetXdQprcVkpaWU") Ghostnet = MustParseChainIdHash("NetXnHfVqm9iesp") @@ -74,8 +74,8 @@ var ( ProtoV017: 17, ProtoV018: 18, ProtoV019: 19, - ProtoV019_2: 19, - ProtoAlpha: 20, + ProtoV020: 20, + ProtoAlpha: 21, } Deployments = map[ChainIdHash]ProtocolHistory{ From 271fd62f89d04b153402044dec8e576a237ca285 Mon Sep 17 00:00:00 2001 From: V <36897290+cryi@users.noreply.github.com> Date: Fri, 2 Aug 2024 10:19:59 +0200 Subject: [PATCH 12/13] Fix concurrent map writes of protocol versions (#14) --- tezos/params.go | 4 ++++ tezos/protocols.go | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tezos/params.go b/tezos/params.go index ef0cc56d..1ecfdd18 100644 --- a/tezos/params.go +++ b/tezos/params.go @@ -123,7 +123,9 @@ func (p *Params) WithChainId(id ChainIdHash) *Params { func (p *Params) WithProtocol(h ProtocolHash) *Params { var ok bool p.Protocol = h + versionsMtx.RLock() p.Version, ok = Versions[h] + versionsMtx.RUnlock() if !ok { var max int for _, v := range Versions { @@ -133,6 +135,8 @@ func (p *Params) WithProtocol(h ProtocolHash) *Params { max = v } p.Version = max + 1 + versionsMtx.Lock() + defer versionsMtx.Unlock() Versions[h] = p.Version } switch { diff --git a/tezos/protocols.go b/tezos/protocols.go index 3152c290..5b4e1a4c 100644 --- a/tezos/protocols.go +++ b/tezos/protocols.go @@ -3,6 +3,8 @@ package tezos +import "sync" + var ( ProtoAlpha = MustParseProtocolHash("ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK") ProtoGenesis = MustParseProtocolHash("PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i") @@ -52,7 +54,8 @@ var ( Parisnet = MustParseChainIdHash("NetXR64bNAYkP4S") ParisCnet = MustParseChainIdHash("NetXXWAHLEvre9b") - Versions = map[ProtocolHash]int{ + versionsMtx = sync.RWMutex{} + Versions = map[ProtocolHash]int{ ProtoGenesis: 0, ProtoBootstrap: 0, ProtoV001: 1, From ddba57335996f87f6038c308a7ff47c5a5c56820 Mon Sep 17 00:00:00 2001 From: huancheng-trili <168652455+huancheng-trili@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:12:48 +0100 Subject: [PATCH 13/13] fix: Fix format error (#13) --- examples/contract/main.go | 2 +- examples/tzgen/FA2NFT.go | 2 +- examples/tzgen/Hello.go | 2 +- examples/tzgen/Payable.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/contract/main.go b/examples/contract/main.go index 48f52c10..2b61d981 100644 --- a/examples/contract/main.go +++ b/examples/contract/main.go @@ -436,7 +436,7 @@ func balance_of(ctx context.Context, c *rpc.Client, addr, owner, id string) erro return err } req := []contract.FA2BalanceRequest{ - contract.FA2BalanceRequest{ + { Owner: own, TokenId: tezos.NewZ(i), }, diff --git a/examples/tzgen/FA2NFT.go b/examples/tzgen/FA2NFT.go index 6f3fce60..6e4c2660 100644 --- a/examples/tzgen/FA2NFT.go +++ b/examples/tzgen/FA2NFT.go @@ -10,12 +10,12 @@ import ( "math/big" "time" + "github.com/pkg/errors" "github.com/trilitech/tzgo/contract" "github.com/trilitech/tzgo/contract/bind" "github.com/trilitech/tzgo/micheline" "github.com/trilitech/tzgo/rpc" "github.com/trilitech/tzgo/tezos" - "github.com/pkg/errors" ) // Fa2Nft is a generated binding to a Tezos smart contract. diff --git a/examples/tzgen/Hello.go b/examples/tzgen/Hello.go index 2ea416bf..b62291b5 100644 --- a/examples/tzgen/Hello.go +++ b/examples/tzgen/Hello.go @@ -10,12 +10,12 @@ import ( "math/big" "time" + "github.com/pkg/errors" "github.com/trilitech/tzgo/contract" "github.com/trilitech/tzgo/contract/bind" "github.com/trilitech/tzgo/micheline" "github.com/trilitech/tzgo/rpc" "github.com/trilitech/tzgo/tezos" - "github.com/pkg/errors" ) // Hello is a generated binding to a Tezos smart contract. diff --git a/examples/tzgen/Payable.go b/examples/tzgen/Payable.go index 900325d8..cb1ae2f8 100644 --- a/examples/tzgen/Payable.go +++ b/examples/tzgen/Payable.go @@ -10,12 +10,12 @@ import ( "math/big" "time" + "github.com/pkg/errors" "github.com/trilitech/tzgo/contract" "github.com/trilitech/tzgo/contract/bind" "github.com/trilitech/tzgo/micheline" "github.com/trilitech/tzgo/rpc" "github.com/trilitech/tzgo/tezos" - "github.com/pkg/errors" ) // Payable is a generated binding to a Tezos smart contract.