@@ -110,23 +110,31 @@ namespace fc::vm::runtime {
110
110
return storage::ipfs::IpfsDatastoreError::kNotFound ;
111
111
}
112
112
113
- Env::Env (const EnvironmentContext &env_context,
114
- TsBranchPtr ts_branch,
115
- TipsetCPtr tipset)
116
- : ipld{std::make_shared<IpldBuffered>(env_context.ipld )},
117
- state_tree{std::make_shared<StateTreeImpl>(
118
- this ->ipld , tipset->getParentStateRoot ())},
119
- env_context{env_context},
120
- epoch{tipset->height ()},
121
- ts_branch{std::move (ts_branch)},
122
- tipset{std::move (tipset)},
123
- pricelist{epoch} {
124
- setHeight (epoch);
113
+ outcome::result<std::shared_ptr<Env>> Env::make (
114
+ const EnvironmentContext &env_context,
115
+ TsBranchPtr ts_branch,
116
+ TipsetCPtr tipset) {
117
+ auto env{std::make_shared<Env>()};
118
+ env->ipld = std::make_shared<IpldBuffered>(env_context.ipld );
119
+ env->state_tree = std::make_shared<StateTreeImpl>(
120
+ env->ipld , tipset->getParentStateRoot ());
121
+ env->env_context = env_context;
122
+ env->epoch = tipset->height ();
123
+ env->ts_branch = std::move (ts_branch);
124
+ env->tipset = std::move (tipset);
125
+ env->pricelist = Pricelist{env->epoch };
126
+ OUTCOME_TRY (env->setHeight (env->epoch ));
127
+ return env;
125
128
}
126
129
127
- void Env::setHeight (ChainEpoch height) {
130
+ outcome::result< void > Env::setHeight (ChainEpoch height) {
128
131
epoch = height;
129
132
ipld->actor_version = actorVersion (height);
133
+ if (env_context.circulating ) {
134
+ OUTCOME_TRYA (base_circulating,
135
+ env_context.circulating ->circulating (state_tree, height));
136
+ }
137
+ return outcome::success ();
130
138
}
131
139
132
140
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
0 commit comments