Skip to content

Commit

Permalink
feat: enable continual anchoring mode (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
smrz2001 authored Jul 31, 2023
1 parent 66fef32 commit 4c1479a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 5 additions & 3 deletions common/aws/ddb/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ func (jdb *JobDatabase) createJobTable(ctx context.Context) error {
func (jdb *JobDatabase) CreateJob(ctx context.Context) (string, error) {
jobParams := map[string]interface{}{
models.JobParam_Version: models.WorkerVersion, // this will launch a CASv5 Worker
models.JobParam_Overrides: map[string]interface{}{
models.AnchorOverrides_AppMode: models.AnchorAppMode_ContinualAnchoring,
models.AnchorOverrides_SchedulerStopAfterNoOp: true,
},
}
// If an override anchor contract address is available, pass it through to the job.
if contractAddress, found := os.LookupEnv(models.Env_AnchorContractAddress); found {
jobParams[models.JobParam_Overrides] = map[string]string{
models.AnchorOverrides_ContractAddress: contractAddress,
}
jobParams[models.JobParam_Overrides].(map[string]interface{})[models.AnchorOverrides_ContractAddress] = contractAddress
}
newJob := models.NewJob(models.JobType_Anchor, jobParams)
attributeValues, err := attributevalue.MarshalMapWithOptions(newJob, func(options *attributevalue.EncoderOptions) {
Expand Down
9 changes: 8 additions & 1 deletion models/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ const (
)

const (
AnchorOverrides_ContractAddress = "ETH_CONTRACT_ADDRESS"
AnchorOverrides_AppMode = "APP_MODE"
AnchorOverrides_ContractAddress = "ETH_CONTRACT_ADDRESS"
AnchorOverrides_SchedulerStopAfterNoOp = "SCHEDULER_STOP_AFTER_NO_OP"
)

const (
AnchorAppMode_Anchor = "anchor"
AnchorAppMode_ContinualAnchoring = "continual-anchoring"
)

type JobState struct {
Expand Down

0 comments on commit 4c1479a

Please sign in to comment.