Skip to content

Commit

Permalink
feat(logic): deprecate the chain_id/1 predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Nov 23, 2024
1 parent 94a94a3 commit 8a6144e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion x/logic/interpreter/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var registry = orderedmap.New[string, any](
{Key: "call_nth/2", Value: engine.CallNth},
{Key: "./3", Value: engine.Op3},
{Key: "block_header/1", Value: predicate.BlockHeader},
{Key: "chain_id/1", Value: predicate.ChainID},
{Key: "chain_id/1", Value: predicate.ChainID}, //nolint:staticcheck // Deprecated but still exposed for compatibility.
{Key: "block_height/1", Value: predicate.BlockHeight},
{Key: "block_time/1", Value: predicate.BlockTime},
{Key: "bank_balances/2", Value: predicate.BankBalances},
Expand Down
3 changes: 3 additions & 0 deletions x/logic/predicate/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/axone-protocol/prolog/engine"

cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cometbft/cometbft/proto/tendermint/version"

Expand Down Expand Up @@ -106,6 +107,8 @@ func blockIDToTerm(blockID cmtproto.BlockID) (engine.Dict, error) {
//
// where:
// - ID represents the current chain ID at the time of the query.
//
// Deprecated: Use the `block_header/1` predicate instead.
func ChainID(vm *engine.VM, chainID engine.Term, cont engine.Cont, env *engine.Env) *engine.Promise {
return engine.Delay(func(ctx context.Context) *engine.Promise {
sdkContext, err := prolog.UnwrapSDKContext(ctx, env)
Expand Down

0 comments on commit 8a6144e

Please sign in to comment.