Skip to content

Commit 1b7daef

Browse files
authored
Add Paris support (#28)
* Using ?version for mempool endpoints to avoid renaming endorsement -> attestation * DalPublishCommitment added
1 parent 67c0dcc commit 1b7daef

File tree

9 files changed

+52
-5
lines changed

9 files changed

+52
-5
lines changed

node/chain_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func (api *Chain) LevelsSavepoint(ctx context.Context) (Savepoint, error) {
118118

119119
// PendingOperations -
120120
func (api *Chain) PendingOperations(ctx context.Context) (MempoolResponse, error) {
121-
req, err := newGetRequest(api.baseURL, fmt.Sprintf("chains/%s/mempool/pending_operations", api.chainID), nil)
121+
req, err := newGetRequest(api.baseURL, fmt.Sprintf("chains/%s/mempool/pending_operations?version=1", api.chainID), nil)
122122
if err != nil {
123123
return MempoolResponse{}, err
124124
}

node/chain_data.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ func IsManager(kind string) bool {
142142
kind == KindSrAddMessages || kind == KindSrCement || kind == KindSrExecute ||
143143
kind == KindSrOriginate || kind == KindSrPublish || kind == KindSrRecoverBond ||
144144
kind == KindSrRefute || kind == KindSrTimeout || kind == KindIncreasePaidStorage ||
145-
kind == KindDrainDelegate || kind == KindUpdateConsensusKey
145+
kind == KindDrainDelegate || kind == KindUpdateConsensusKey || kind == KindDalPublishCommitment
146146
}

node/consts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const (
4444
KindSrRecoverBond = "smart_rollup_recover_bond"
4545
KindSrTimeout = "smart_rollup_timeout"
4646
KindSrCement = "smart_rollup_cement"
47+
KindDalPublishCommitment = "dal_publish_commitment"
4748
)
4849

4950
const (

node/monitor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (monitor *Monitor) pollingMempool(ctx context.Context, filter string) {
160160
filter = filterApplied
161161
}
162162

163-
url := fmt.Sprintf("/chains/main/mempool/monitor_operations?%s", filter)
163+
url := fmt.Sprintf("chains/main/mempool/monitor_operations?version=0&%s", filter)
164164

165165
ticker := time.NewTicker(time.Second)
166166
defer ticker.Stop()

node/operations.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type OperationConstraint interface {
1818
TxRollupRemoveCommitment | TxRollupSubmitBatch | UpdateConsensusKey |
1919
DrainDelegate | SmartRollupAddMessage | SmartRollupCement | SmartRollupExecute |
2020
SmartRollupOriginate | SmartRollupPublish | SmartRollupRecoverBond |
21-
SmartRollupRefute | SmartRollupTimeout
21+
SmartRollupRefute | SmartRollupTimeout | DalPublishCommitment
2222
}
2323

2424
// OperationGroup -
@@ -116,6 +116,8 @@ func (op *Operation) UnmarshalJSON(data []byte) error {
116116
err = parseOperation[SmartRollupRefute](data, op)
117117
case KindSrTimeout:
118118
err = parseOperation[SmartRollupTimeout](data, op)
119+
case KindDalPublishCommitment:
120+
err = parseOperation[DalPublishCommitment](data, op)
119121

120122
}
121123
return err
@@ -777,6 +779,24 @@ type SmartRollupTimeout struct {
777779
Metadata *ManagerOperationMetadata `json:"metadata,omitempty"`
778780
}
779781

782+
// DalPublishCommitment -
783+
type DalPublishCommitment struct {
784+
Kind string `json:"kind"`
785+
Source string `json:"source"`
786+
Fee string `json:"fee"`
787+
Counter string `json:"counter"`
788+
GasLimit string `json:"gas_limit"`
789+
StorageLimit string `json:"storage_limit"`
790+
SlotHeader SlotHeader `json:"slot_header"`
791+
Metadata *ManagerOperationMetadata `json:"metadata,omitempty"`
792+
}
793+
794+
type SlotHeader struct {
795+
SlotIndex int `json:"slot_index"`
796+
Commitment string `json:"commitment"`
797+
CommitmentProof string `json:"commitment_proof"`
798+
}
799+
780800
// Stakers -
781801
type Stakers struct {
782802
Alice string `json:"alice"`

tzkt/api/operations.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,9 @@ func (tzkt *API) GetSmartRollupRefute(ctx context.Context, filters map[string]st
257257
err = tzkt.json(ctx, "/v1/operations/sr_refute", filters, false, &operations)
258258
return
259259
}
260+
261+
// GetDalPublishCommitment -
262+
func (tzkt *API) GetDalPublishCommitment(ctx context.Context, filters map[string]string) (operations []data.DalPublishCommitment, err error) {
263+
err = tzkt.json(ctx, "/v1/operations/dal_publish_commitment", filters, false, &operations)
264+
return
265+
}

tzkt/data/consts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const (
4141
KindSrPublish = "sr_publish"
4242
KindSrRecoverBond = "sr_recover_bond"
4343
KindSrRefute = "sr_refute"
44+
KindDalPublishCommitment = "dal_publish_commitment"
4445
)
4546

4647
// urls

tzkt/data/operations.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type OperationConstraint interface {
1616
TxRollupReturnBond | TxRollupSubmitBatch | NonceRevelation | DoubleBaking | DoubleEndorsing | SetDepositsLimit |
1717
DoublePreendorsing | Baking | RevelationPenalty | EndorsingReward | VdfRevelation | IncreasePaidStorage |
1818
DrainDelegate | UpdateConsensusKey | SmartRollupAddMessage | SmartRollupCement | SmartRollupExecute |
19-
SmartRollupOriginate | SmartRollupPublish | SmartRollupRefute | SmartRollupRecoverBond
19+
SmartRollupOriginate | SmartRollupPublish | SmartRollupRefute | SmartRollupRecoverBond | DalPublishCommitment
2020
}
2121

2222
// Operation -
@@ -865,3 +865,20 @@ type SrGameInfo struct {
865865
OpponentReward uint64 `json:"opponentReward"`
866866
OpponentLoss uint64 `json:"opponentLoss"`
867867
}
868+
869+
type DalPublishCommitment struct {
870+
Type string `json:"type"`
871+
ID uint64 `json:"id"`
872+
Level uint64 `json:"level"`
873+
Timestamp string `json:"timestamp"`
874+
Hash string `json:"hash"`
875+
Sender *Address `json:"sender"`
876+
Counter uint64 `json:"counter"`
877+
GasLimit uint64 `json:"gasLimit"`
878+
GasUsed uint64 `json:"gasUsed"`
879+
StorageLimit uint64 `json:"storageLimit"`
880+
BakerFee uint64 `json:"bakerFee"`
881+
Slot int `json:"slot"`
882+
Commitment string `json:"commitment"`
883+
Status string `json:"status"`
884+
}

tzkt/events/tzkt.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ func parseOperations(data []byte) (any, error) {
369369
result = append(result, &tzktData.SmartRollupRecoverBond{})
370370
case tzktData.KindSrRefute:
371371
result = append(result, &tzktData.SmartRollupRefute{})
372+
case tzktData.KindDalPublishCommitment:
373+
result = append(result, &tzktData.DalPublishCommitment{})
372374
default:
373375
result = append(result, make(map[string]interface{}))
374376
}

0 commit comments

Comments
 (0)