mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 09:51:39 +00:00
feature/1220 origin handle exists method (#1241)
* feat: add docs and CI workflow for publishing to onsonr.dev * (refactor): Move hway,motr executables to their own repos * feat: simplify devnet and testnet configurations * refactor: update import path for didcrypto package * docs(networks): Add README with project overview, architecture, and community links * refactor: Move network configurations to deploy directory * build: update golang version to 1.23 * refactor: move logger interface to appropriate package * refactor: Move devnet configuration to networks/devnet * chore: improve release process with date variable * (chore): Move Crypto Library * refactor: improve code structure and readability in DID module * feat: integrate Trunk CI checks * ci: optimize CI workflow by removing redundant build jobs --------- Co-authored-by: Darp Alakun <i@prad.nu>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// Package branch contains the core branch service interface.
|
||||
package branch
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// ErrGasLimitExceeded is returned when the gas limit is exceeded in a
|
||||
// Service.ExecuteWithGasLimit call.
|
||||
var ErrGasLimitExceeded = errors.New("branch: gas limit exceeded")
|
||||
|
||||
// Service is the branch service interface. It can be used to execute
|
||||
// code paths in an isolated execution context that can be reverted.
|
||||
// A revert typically means a rollback on events and state changes.
|
||||
type Service interface {
|
||||
// Execute executes the given function in an isolated context. If the
|
||||
// `f` function returns an error, the execution is considered failed,
|
||||
// and every change made affecting the execution context is rolled back.
|
||||
// If the function returns nil, the execution is considered successful, and
|
||||
// committed.
|
||||
// The context.Context passed to the `f` function is a child of the context
|
||||
// passed to the Execute function, and is what should be used with other
|
||||
// core services in order to ensure the execution remains isolated.
|
||||
Execute(ctx context.Context, f func(ctx context.Context) error) error
|
||||
// ExecuteWithGasLimit executes the given function `f` in an isolated context,
|
||||
// with the provided gas limit, this is advanced usage and is used to disallow
|
||||
// an execution path to consume an indefinite amount of gas.
|
||||
// If the execution fails or succeeds the gas limit is still applied to the
|
||||
// parent context, the function returns a gasUsed value which is the amount
|
||||
// of gas used by the execution path. If the execution path exceeds the gas
|
||||
// ErrGasLimitExceeded is returned.
|
||||
ExecuteWithGasLimit(ctx context.Context, gasLimit uint64, f func(ctx context.Context) error) (gasUsed uint64, err error)
|
||||
}
|
||||
Reference in New Issue
Block a user