-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
ParachainHost_disputes
runtime call (#4554)
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package provisioner | ||
|
||
import ( | ||
"fmt" | ||
|
||
parachain "github.com/ChainSafe/gossamer/dot/parachain/runtime" | ||
parachaintypes "github.com/ChainSafe/gossamer/dot/parachain/types" | ||
"github.com/ChainSafe/gossamer/lib/common" | ||
) | ||
|
||
type BlockState interface { | ||
GetRuntime(blockHash common.Hash) (instance parachain.RuntimeInstance, err error) | ||
} | ||
|
||
// GetOnchainDisputes gets the on-chain disputes at a given block number and returns them as a map | ||
// for efficient searching. It takes a relay parent hash and returns a map of session index and | ||
// candidate hash tuples to dispute states. | ||
func GetOnchainDisputes( | ||
blockstate BlockState, | ||
relayParent common.Hash, | ||
) (map[parachaintypes.DisputeKey]parachaintypes.DisputeState, error) { | ||
rt, err := blockstate.GetRuntime(relayParent) | ||
if err != nil { | ||
return nil, fmt.Errorf("getting runtime for relay parent %s: %w", relayParent, err) | ||
} | ||
|
||
disputes, err := rt.ParachainHostDisputes() | ||
if err != nil { | ||
return nil, fmt.Errorf("getting disputes from runtime: %w", err) | ||
} | ||
|
||
return disputes, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.