oracle-core icon indicating copy to clipboard operation
oracle-core copied to clipboard

Consider separating parameter values from `*ContractParameters`

Open greenhat opened this issue 3 years ago • 4 comments

Now we're using them as expected constant values on contract parsing. I suggest we remove them from *ContractParameters since the structs are already heavy. Plus, we might introduce a new struct below.

In bootstrap, we should be able to set new min_data_points and other contract parameter values rather than compiling the contract with a new value to have the new constant value.

OR

re-designate them to be treated as new parameters on bootstrap or expected parameters in all other cases. Distinguish via two methods in *Contract (load/create?)

greenhat avatar Aug 09 '22 14:08 greenhat

Hmm, I ran into this issue as well when trying to deploy a new refresh contract in update. I think one way might be a way to add expected parameters, where those are simply used to assert that the contract has the correct default parameters corresponding to each constant index

refresh_contract_parameters:
  p2s: 62TTAg5ZqAM7HwjB169cSSn844L2ZmMq4xjen6QcGt9Bb6ssYBgg3SNHuRiDqJmHYXbdgU179G5WiYPMq5VgUHDPbjHpDSE95sfKszRFXzLKkSUxrQTMR1f9Rohi1yLubR7XtZggBNteASRhCfiKZyuw1YuCzRyVPVdmfJ3D5W1Vf13oZ4doCivwHN8YgDii4WxqvsR3m1iKrv3eB3H8iSrqzmh2bPP5TUJ7oKfkk3vtgNXQwkioCE76Pmvy4scW4pMHqQxmjswDNCPdK2uHmqATKnKj6nkqJFgnTx8Y1Yn63h2wu8W6Lr1oYGE1JpcQqPnYeK2qmmFrHbQ9TjPm5ucdQSrHGXKm9fvcE41LxCmcsBU53AYb1CXmtepSGiK38vBW4CxsSnMcqug4PbiWZjjFypDFaysfpy9scFdgKtEQx5PV92dhfT7L1Xz39DUUsTWJ2yGf4GzeGsEuG6prTto9CNc7xX3BA89kDiJ872WMednh9pG1MFAwyW3S2LgPiF4UyxGBUYbmkbEZUCjVoFg4Mq26f5iBiqSatTgHFtqEbYPJ9tuAjq9vr7t3DTdxzfJ3xsgGxM7CrjA9Jn1ohbuUdYxzh6F1sanQgwr161PfGHufiU7Wx4gGJ6tLcf3Zh38SGS8EToHUs7mtBtmDWWWGRZXwhyEffTTZyGoRd68pj3E9dYUJs7sVmGZzYS6GtfY5ksrJEpmZ4dRxckrGf5haYNdixXQfNkEm2a5vEpfsm4Lg8Z78xGSozW
  pool_nft_index: 17
  oracle_token_id_index: 3
  min_data_points_index: 13
  min_data_points: 4
  buffer_index: 21
  buffer_length: 4
  max_deviation_percent_index: 15
  max_deviation_percent: 4
  epoch_length_index: 0
  epoch_length: 30
  expected_parameters:
     max_deviation_percent: 5
     epoch_length: 30
     buffer_length:4

re-designate them to be treated as new parameters on bootstrap or expected parameters in all other cases. Distinguish via two methods in *Contract (load/create?)

I like this option, bootstrap can generate P2S addresses in final oracle_config.yaml with the custom parameters set.

sethdusek avatar Aug 10 '22 08:08 sethdusek

@dusek I'm leaning toward the second option as well. More so, I'm thinking of generating new p2s for updated contracts on bootstrap and afterward treat all contract parameter values from the config as expected. So that after the bootstrap, the config has p2s precisely the same as boxes on-chain.

greenhat avatar Aug 10 '22 08:08 greenhat

@dusek I'm leaning toward

@greenhat you probably meant @SethDusek instead ;-)

dusek avatar Aug 10 '22 10:08 dusek

@dusek I'm leaning toward

@greenhat you probably meant @SethDusek instead ;-)

Yes! Sorry for the ping and thank you for letting me know!

greenhat avatar Aug 10 '22 13:08 greenhat